public class ZhuHeight{
public static void main(String[] args){
double width = 0.01; //纸张厚度
//for循环实现
for(int i=1;;i++){
double high = Math.pow(2,i) * width; //总的高度
if(high >= 8848){
System.out.println("for折的次数:" + i);
break;
}
}
//while实现
int i = 1;
double high = 0;
while(high < 8848){
high = Math.pow(2,i) * width;
if(high >= 8848){
System.out.println("while折的次数:" + i);
}
i++;
}
}
}