3.18练习

题目3

代码:

package test3_18;

public class test2 {

    public static void main(String[] args) {
        int fenMu = (int) Math.pow(2,19);
        int fenZi = 0;
        double sum = 0;
       for(int i=0;i<20;i++){
           fenZi += Math.pow(2,i);
       }

        System.out.printf("%d/%d\n",fenZi,fenMu);
    }
}

运行截图:

猜你喜欢

转载自blog.csdn.net/m0_63911789/article/details/129636130
今日推荐