Variables used
fact=1,p=1,e=1,x,n,i
Program
#include<stdio.h>
main()
{
int x,n,i;
float fact=1,p=1,e=1;
printf("Enter the values of x & n");
scanf("%d%d",&x,&n);
for(i=1;i<n;i++)
{
p=p*x;
fact=fact*i;
e=e+(p/fact);
}
printf("%f",e);
}
fact=1,p=1,e=1,x,n,i
Program
#include<stdio.h>
main()
{
int x,n,i;
float fact=1,p=1,e=1;
printf("Enter the values of x & n");
scanf("%d%d",&x,&n);
for(i=1;i<n;i++)
{
p=p*x;
fact=fact*i;
e=e+(p/fact);
}
printf("%f",e);
}
No comments:
Post a Comment