Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- double e(double x);
- int main()
- {
- double x;
- printf("Enter x: ");
- scanf("%lf", &x);
- printf("e ^ %lf = %lf\n", x, e(x));
- return 0;
- }
- double e(double x)
- {
- double ans = 0;
- double term = 1;
- int i;
- for(i = 1; i < 10; i++)
- {
- ans += term;
- term *= x/i;
- }
- return ans;
- }
Advertisement
Add Comment
Please, Sign In to add comment