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