/* SUM OF SERIES UP TO N TERMS */
#include<stdio.h>
#include<conio.h>
#include<math.h>
main()
{
int i,n,x,sum=1,fact=1,term;
clrscr();
printf("\n Enter no.of terms: ");
scanf("%d",&n);
printf("\n Enter x vale: ");
scanf("%d",&x);
for(i=1;i<n;i++)
{
term=pow(x,i);
fact=fact*i;
sum=sum+(term/fact);
}
printf("\n Sum of series is = %d",sum);
getch();
}
No comments:
Post a Comment