fork(5) download
  1. #include <iostream>
  2. #include <math.h>
  3.  
  4. int main() {
  5. double i, f = 1, p = 1;
  6. int n;
  7. scanf("%d",&n);
  8. for(int i = 1; i <= n; i++)
  9. {
  10. f = f * i;
  11. p *= ( 1 / f + 2);
  12. }
  13. printf("%f ", p);
  14. return 0;
  15. }
Success #stdin #stdout 0s 3344KB
stdin
6

stdout
133.353827