Write a program to calculate the result of the formula pi in java π=4(1β1/3+1/5β1/7+1/9β1/11+1/13ββ―β1/2πβ1+1/2π+1) with 10000 β€ i β€ 100000
public class PI { public static void main(String[] args) { // 4(1-1/3+1/5-1/7+1/9-1/11+1/13-β―-1/2πβ1+1/2π+1) double pi = 0; int i = 10000; while (i <= 100000) { if (i % 2 == 0) { pi = pi + 1 / (2 * i + 1); } else { pi = pi - 1 / (2 * i + 1); } i++; } pi = 4 * pi; System.out.println(pi); } }