题目:
珠穆朗玛峰高度为8848.86米,一张纸的厚度为0.1毫米,折叠多少次可以折叠超过珠穆朗玛峰的高度(不考虑纸的折叠限制)
代码:
public class yunsuan {
public static void main(String[] args) {
double paper = 0.1;
double mountain = 8848860;
int count = 0;
while (paper < mountain){
paper = paper * 2;
count ++;
}
System.out.println("折叠"+count+"次");
System.out.println("最终厚度为"+paper+"毫米");
}
}