/* To evaluate the
sum of the series */
#include<stdio.h>
#include<conio.h>
void
main()
{
int x,i;
long int fact=1;
float sum=1.0;
clrscr();
printf("Enter the range: ");
scanf("%d",&x);
for(i=1;i<=x;i++)
{
fact=fact*x;
sum=sum+(1.0/fact);
}
printf("\nNumber of terms=%d \nSum of
Series=%f",i-1,sum);
getch();
}
OUTPUT
Enter
the range: 5
Number
of terms=5
Sum
of Series=1.249920
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.