fork download
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5. double p=1;
  6. double a=1;
  7. for (int i=2; i<=10; i++)
  8. {
  9. a*=i;
  10. p*=(1.0-1.0/a)*(1.0-1.0/a);
  11. }
  12. printf("p= %0.4lf", p);
  13. return 0;
  14. }
  15.  
Success #stdin #stdout 0s 2248KB
stdin
Standard input is empty
stdout
p= 0.1563