fork download
  1. #include <stdio.h>
  2. #include <math.h>
  3. int main(void) {
  4. int n;
  5. double x,e=1,fac=1,t;
  6. scanf("%d %lf",&n,&x);
  7. if(n==0){printf("%lf",e);return 0;}
  8. t=x;
  9. for(int i=1;i<=n;i++)
  10. {
  11.  
  12. fac*=i;
  13. e+=t/fac;
  14. t*=x;
  15. }
  16. printf("%lf",e);
  17. return 0;
  18. }
Success #stdin #stdout 0s 2160KB
stdin
6 0
stdout
1.000000