[ create a new paste ] login | about

Link: http://codepad.org/kEvnrtHj    [ raw code | output | fork ]

C, pasted on Apr 19:
#include<stdio.h>
#include<conio.h>

float Tinh(float x, int n)
{
	if(n == 0)
		return 0;
	if(n == 1)
		return x;
	return (1 + x/n) * Tinh(x, n - 1) - (x/n) * Tinh(x, n - 2);
}
int main()
{
	float x;
	int n;

	printf("\nNhap x: "); scanf("%f", &x);
	printf("\nNhap n: "); scanf("%d", &n);

	float kq = Tinh(x, n);
	printf("\nKet qua = %.2f", kq);

	getch();
	return 0;
}


Output:
1
Line 17: error: conio.h: No such file or directory


Create a new paste based on this one


Comments: