//纸张折叠成珠穆朗玛峰高度的次数? 纸张厚度0.01米
public class Testzhezhi {
public static void main(String[] args) {
int count = 0;
double zhi = 0.01;
double feng = 8848.8;
while (true) {
//纸的厚度等于他自己乘以2
zhi = zhi * 2;
//折一次计数一次
count++;
System.out.println(zhi);
System.out.println(count);
//如果纸张厚度大于峰的高度 输出高度,退出循环
if (feng < zhi) {
System.out.println(":::::::;"+count);
break;
}
}
}
} |