作者:马宝宝 | 来源:互联网 | 2023-05-22 13:13
1> Andrew Alder..:
您需要在循环中每次都设置nCubed值:
public static void main(String[] args) {
int n = 0;
int nCubed = (int) (Math.pow(n, 3));
while (nCubed <12000) {
n++;
nCubed = (int) (Math.pow(n, 3));
}
System.out.println("The highest integer below 12000 is " +(n-1));
}