Subject description:
Cube change itself
Watch out phenomenon, a certain number of cubic meters, accumulated bit still equal to itself.
1 ^ 3 = 1
. 8 ^ 3 + 1 = 5125 + 2 = 8
17 49 134 ^ 3 = 1 + 9 + 3 = 17 +
...
Make your positive integer calculations include 1,8,17 included, in line with the nature of a total of how many?
Please fill in the numbers, do not fill in any extra content or descriptive text.
Directly on the code:
package wiki.zimo.exam06;
public class Demo02 {
public static void main(String[] args) {
int count = 0;
for (int i = 1; i < 100; i++) {
int temp = i * i * i;
int sum = 0;
while (temp != 0) {
sum += temp % 10;
temp = temp / 10;
}
if (i == sum) {
count++;
}
}
System.out.println(count);
}
}