Source Code :
#include<stdio.h>
void main()
{
int i,j,n; //Declaration of variables
long float fact=1,sum=0,div; //Declaration of variables
clrscr();
{
fact=1;
for(j=1;j<=i;j++)
{
fact*=j; //Calculation of Factorial
}
div=i/fact;
sum+=div;
}
printf("\nSum of First Seven Terms : %5.2f",sum);
getch();
}
Output :
No comments:
Post a Comment