Advertisement
nguyenhappy92

Tính e^x

Oct 22nd, 2015
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. // Khai bao cac ham thu vien cua chuowng trinh
  2. //
  3. #include<stdio.h>
  4. #include<conio.h>
  5. void main()
  6. {
  7. int n,x;
  8. scanf("%d%d",&n,&x);
  9. if(n==0)
  10. printf("1");
  11. else
  12. {
  13. long double t=1;
  14. long double s=1;
  15. long double kq=0;
  16. for(int i=1;i<=n;i++)
  17. {
  18. t=t*x;
  19. s=s*i;
  20. kq=kq+ t/s;
  21. }
  22. printf("%.3lf",kq);
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement