第五章第十二题(求满足n^2 > 12000的n的最小值)(Find the smallest n such that n^2 > 12000)
5.12(求满足n^2 > 12000的n的最小值)使用while循环找出满足n * n 大于12000的最小整数n。 5.12(Find the smallest n such that n^2 > 12000)Use a while loop to find the smallest integer n such that n * n is greater than 12,000.
参考代码:
package chapter05;publicclassCode_12{publicstaticvoidmain(String[] args){int n =1;while(Math.pow(n,2)<=12000)
n++;
System.out.println("The smallest integer n is "+ n);}}
结果显示:
The smallest integer n is 110
Process finished with exit code 0
第五章第十二题(求满足n^2 > 12000的n的最小值)(Find the smallest n such that n^2 > 12000)
第五章第十二题(求满足n^2 > 12000的n的最小值)(Find the smallest n such that n^2 > 12000)5.12(求满足n^2 > 12000的n的最小值)使用while循环找出满足n * n 大于12000的最小整数n。5.12(Find the smallest n such that n^2 > 12000)Use a while loop to find the smallest integer n such that n * n