循环语句

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+"次可达到珠穆拉玛峰的高度");
    }

}

 

posted @ 2016-01-05 11:58  梦里梦到梦  阅读(125)  评论(0编辑  收藏  举报