fork download
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4. int cool (int a)
  5. {
  6. float b = float (a);
  7. if (sqrt(b)==int (sqrt(b))&&cbrt(b)==int(cbrt(b)))
  8. {
  9. return 1;
  10. }
  11. else
  12. {
  13. return 0;
  14. }
  15. }
  16. int main() {
  17.  
  18. int a, b, count=0, col;
  19. cin >> a >> b;
  20. for (int i = a; i <= b; i++)
  21. {
  22. col = cool(i);
  23. if (col==1)
  24. {
  25. count++;
  26. cout << i << endl;
  27. }
  28. }
  29. cout << count;
  30. return 0;
  31. }
Success #stdin #stdout 0s 3460KB
stdin
100
1000
stdout
Standard output is empty