1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
|
public static void main(String[] args) {
System.out.println(pi());
}
static double pi() {
return Math.sqrt(6 * piRecurs(1));
}
static double piRecurs(double nzahl) {
if (nzahl >= 1000)
return 0;
return 1 / (nzahl * nzahl) + piRecurs(nzahl + 1);
} |