Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <math.h>
- int main()
- {
- int x,n;
- int i,j,fact=1;
- float sum=1;
- printf("Enter the value of X to calculate e^x \n X : %d",x);
- scanf("%d",&x);
- printf("Enter the number of terms \n N :%d",n);
- scanf("%d",&n);
- for(i=1;i<=n;i++)
- {
- for(j=i;j<=n;j++)
- {
- fact=fact*j;
- break;
- }
- if(i==j)sum=sum+pow(x,i)/fact;
- }
- printf("e^x = %f",sum);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement