1月6日 作业 课后题

 2 打印菱形

没看懂 不会

3

public class zuoye {

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


double j = 1;
        
        double k = 1;
        
        double h = 0;
        
        while (j <= 20)
        {
            k = k * j;
            
            j++;
            
            h = h + 1/k;
            
        }
        System.out.println("1+1/2!+...1/20!="+h);
    }

}

1+1/2!+...1/20!=1.7182818284590455

原文地址:https://www.cnblogs.com/yifangtongxing/p/5107894.html