1 public class Solution 2 { 3 public static void main(String[] args) 4 { 5 double sum; 6 double item; 7 for(int i = 10000; i<= 100000; i += 10000) 8 { 9 item = 1; 10 sum = 0; 11 for(int j = 1; j <= i; j++) 12 { 13 item = item * 1.0 / i; 14 sum += item; 15 } 16 17 System.out.println("i = " + i + ", e = " + sum); 18 } 19 } 20 }
时间: 2024-12-17 15:19:22