repl.it
Java

No description

fork
loading
Files
  • Main.java
  • jdt.ls-java-project
Main.java
1
2
3
4
5
6
7
8
9
10
11
12
public class Main {
  public static void main(String[] args) {
    System.out.println(calcPi(10));
  }
  public static double calcPi(int iterations){
	double val = 0.0;
	for(int x = 0; x < iterations; x++){
		val += (Math.pow(4.0 * (-1),x) / (2*x + 1));
	}
	return val;
  }
}
Fetching token
?