fork download
  1. #include <cstdlib>
  2. #include <iostream>
  3. #include <cmath>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9. double e;
  10. cin >> e;
  11. double a=1, l;
  12. do{
  13. l = sin(1/a) * a;
  14. a *= 2;
  15. }while( abs(l-1)>e );
  16. a /= 2;
  17. cout << "Проверка пройдена при x ==" << ( a == 1 ? " " : " 1/" ) << a << endl;
  18. }
Success #stdin #stdout 0s 3476KB
stdin
0.009
stdout
Проверка пройдена при x == 1/8