Advertisement
Guest User

Untitled

a guest
Nov 20th, 2019
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.25 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <math.h>
  3.  
  4. float y,t; int k;
  5.  
  6. void calc(float x){
  7.  
  8. y=0;
  9. for (k=1,t=1; t> 0; k++) {
  10. y=y+t;
  11. t=t*x/k;
  12. }
  13. printf ("%15.6f %15.6f \n",y, exp(x));
  14. }
  15.  
  16. int main () {
  17. float x;
  18. scanf ("%f",&x);
  19. calc(x);
  20. return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement