循环语句

public class xunhuan1 {

    public static void main(String[] args) {
        // TODO 自动生成的方法存根

        double a = 0;
double b = 0.00008; while (b < 8848) { b *= 2; a++; // System.out.println(b); } //System.out.println(b); System.out.println("一张纸折叠"+a+"次可达到珠穆拉玛峰的高度"); } }
public class xunhuan1 {

    public static void main(String[] args) {
        // TODO 自动生成的方法存根
int j=0;
        for(double i=0.00008;i<8848;i*=2,j++)
        {
            //System.out.println(i);
        }
        System.out.println("一张纸折叠"+j+"次可达到珠穆拉玛峰的高度");
    }

}
原文地址:https://www.cnblogs.com/zhanghaozhe8462/p/5101873.html