/* PROGRAM FOR EVALUATE X SERIES */
#include<stdio.h>
#include<conio.h>
#include<math.h>
main()
{
int i=1,x,n,sum=1,fact=1,p;
clrscr();
printf("\n Enter no.of terms:");
scanf("%d",&n);
printf("\n Enter x value:");
scanf("%d",&x);
while(i<=n)
{
p=pow(x,i);
fact=fact*i;
sum=sum+p/fact;
i++;
}
printf("\n The X series result is = %d",sum);
getch();
}
#include<stdio.h>
#include<conio.h>
#include<math.h>
main()
{
int i=1,x,n,sum=1,fact=1,p;
clrscr();
printf("\n Enter no.of terms:");
scanf("%d",&n);
printf("\n Enter x value:");
scanf("%d",&x);
while(i<=n)
{
p=pow(x,i);
fact=fact*i;
sum=sum+p/fact;
i++;
}
printf("\n The X series result is = %d",sum);
getch();
}
No comments:
Post a Comment