我叫王超然,是一名电脑爱好者,现在在新加坡留学上高一.我立志成为一名电脑人才,愿意在这里与大家一同分享我玩转电脑的心得.O-level华文考了A-One哈哈!
天气: 晴朗
心情: 高兴
/*P3Q13
* Wang Chaoran
* Description:13 (Finding the largest n such that n3 < 12000)
Use a while loop to find the largest integer n such that n3 is less than 12,000.
*/
public class P3Q13
{
public static void main(String[] args)
{
int n=1;
//Compute the largest integer n such that n is less than 12,000.
while(n*n*n<12000)
{
n++;
}
//Print the output
System.out.println("the largest integer n such that n3 is less than 12,000: "+(n-1));
}
}
导入论坛查看(49)回复(0)引用(0)好评(0) 差评(0)
加入收藏
编辑
审核
TAG:
computing