public class Solution { public static void main(String[] args) { double sum; for(int i = 10000; i <= 100000; i += 10000) { sum = 0; for(int j = 1; j <= i; j++) sum += 4 * (1.0 / (2 * j - 1) - 1.0 / (2 * j + 1)); System.out.println("i = " + i + ", π = " + sum); } } }