fork download
  1. #include <cmath>
  2. #include <limits>
  3. #include <iostream>
  4. int main()
  5. {
  6. for(int i = 0; i < 100; ++i)
  7. {
  8. double root = std::sqrt(i);
  9. if( std::abs(root - std::floor(root)) < root*std::numeric_limits<double>::epsilon() )
  10. std::cout << i << '\n';
  11. }
  12. }
  13.  
Success #stdin #stdout 0.01s 2724KB
stdin
Standard input is empty
stdout
1
4
9
16
25
36
49
64
81