Source Code :
#include<stdio.h>
#include<math.h>
void main()
{
int x,n,i,j,fact;
float sum=1;
printf("\nEnter the Value of 'x' : ");
scanf("%d",&x);
printf("\nEnter the value of 'n' : ");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
fact=1;
for(j=1;j<=i;j++)
{
fact*=j;
}
sum=sum+(pow(x,i)/fact);
}
printf("\nSum of the Series : %5.2f",sum);
getch();
}
Output :
Enter the Value of ‘x’ : 2
Enter the Value of ‘n’ : 5
No comments:
Post a Comment