Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <math.h>
- float y,t; int k;
- void calc(float x){
- y=0;
- for (k=1,t=1; t> 0; k++) {
- y=y+t;
- t=t*x/k;
- }
- printf ("%15.6f %15.6f \n",y, exp(x));
- }
- int main () {
- float x;
- scanf ("%f",&x);
- calc(x);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement