fork download
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4. main(){
  5.  
  6. int n = 1;
  7. double x = 0.9;
  8. double an = x;
  9. while(fabs(an) >= 0.6)
  10. {
  11. n++;
  12. an *= x/n;
  13. }
  14. cout << n;
  15.  
  16.  
  17. return 0;
  18. }
Success #stdin #stdout 0s 2684KB
stdin
Standard input is empty
stdout
2