HW4.26

时间:2022-02-15 06:57:41

HW4.26

 public class Solution
 {
     public static void main(String[] args)
     {
         double sum;
         double item;
         for(int i = 10000; i<= 100000; i += 10000)
         {
             item = 1;
             sum = 0;
             for(int j = 1; j <= i; j++)
             {
                 item = item * 1.0 / i;
                 sum += item;
             }

             System.out.println("i = " + i + ", e = " + sum);
         }
     }
 }

相关文章