Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <math.h>
- int main()
- {
- freopen("lab-03-07.in", "r", stdin);
- freopen("lab-03-07.out", "w", stdout);
- int n, i;
- int t[10000];
- double x, EPS, s1, s2, s3, s4;
- scanf("%lf %d %lf", &x, &n, &EPS);
- t[0] = 1;
- s3 = 1;
- if(EPS>1)
- {
- s4 = 1;
- }
- else
- {
- s4 = 0;
- }
- for(i=1;i<=n;i++)
- {
- t[i] = t[i-1] * x/i;
- s3+=t[i];
- if(t[i]>EPS)
- s4+=t[i];
- }
- s1 = exp(x);
- s2 = pow(2.718, x);
- printf("%lf %lf %lf %lf\n", s3, s4, s1, s2);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment