C Program to find Sum of Series using Function
#include#include long int sum_sqr(int); main() { int n; clrscr(); printf("\n Enter any number : "); scanf("%d",&n); printf("\n Sum of Series is %ld",sum_sqr(n)); printf("\n\n Press any key to exit. . ."); getch(); } long int sum_sqr(int m) { if(m<=1) return 1; else return (m*m+sum_sqr(m-1)); }
No comments:
Post a Comment