[ create a new paste ] login | about

Link: http://codepad.org/ivkB5e8O    [ raw code | output | fork ]

C++, pasted on Apr 16:
1
2
3
4
5
6
7
8
9
10
11
12
#include <math.h>
#include <iostream.h>
using namespace std;
int main()
{
    for (int i = 1; i <= 1000; i++)
    {
        if (abs(pow(i, 0.5) - (int)pow(i, 0.5)) < 0.001 ||
            abs(pow(i, 1/3.0) - (int)pow(i, 1/3.0)) < 0.001)
            cout << i << endl;
    }
}


Output:
1
4
8
9
16
25
27
36
49
64
81
100
121
144
169
196
225
256
289
324
361
400
441
484
529
576
625
676
729
784
841
900
961


Create a new paste based on this one


Comments: