CODE ::
#include <stdio.h>
long int fact(int n);
long int p(int n);
int main ()
{
double sum=0;
int i,n;
printf("Enter term N = ");
scanf("%d",&n);
for(i=1;i<=n;i++)
sum = sum + (double)p(i)/(double)fact(i);
printf("%lf\n",sum);
return 0;
}
long int fact (int n)
{
int i,res=1;
for(i=n;i>=1;i--)
res = res*i;
return res;
}
long int p (int n)
{
return n*n;
}
No comments:
Post a Comment