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 static float pi(int n){ float pi; float t = 0f; for (int i = 1; i <= n; i++){ t += Math.pow(-1, i-1)/(2*i-1); } pi = 4 * t; return pi; } public static void main(String[] args) { System.out.println("pi(10000) = " + pi(10000)); System.out.println("pi(100000) = " + pi(100000)); }