[ create a new paste ] login | about

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

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

long tinhXn(int n)
{
	if(n == 0)
		return 1;
	long s = 0;
	for(int i = 1; i <= n; i++)
	{
		s = s + i * i * tinhXn(n - i);
	}
	return s;
}
int main()
{
	int n;
	printf("\nNhap n: "); scanf("%d", &n);

	long s = tinhXn(n);
	printf("S = %ld", s);

	getch();
	return 0;
}


Output:
1
2
3
Line 17: error: conio.h: No such file or directory
In function 'tinhXn':
Line 9: error: 'for' loop initial declaration used outside C99 mode


Create a new paste based on this one


Comments: