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
import java.util.Scanner; class ComputePi { public static void main(String[] args) { Scanner sc = new Scanner(System.in); double n = sc.nextDouble(); double s = 0; for (int i = 0; i <= n; i++) { s += Math.pow(-1, i) / (2 * i + 1); } System.out.println(4 * s); } }