Guest User

Untitled

a guest
Aug 20th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.37 KB | None | 0 0
  1.  
  2. public class PiBerechnenAnwendung {
  3.  
  4.     public static void main(String args[]){
  5.     int k;
  6.     k = 0;
  7.     double pi;
  8.     BerechnePI(pi, k);
  9.     System.out.println(pi);
  10.    
  11.  
  12.     private static void BerechnePI(double pi, int k) {
  13.         k++;
  14.         while(k<=3)
  15.         pi=(1/16^k)*(((4.0/(8.0*k+1.0))-(2.0/(8.0*k+4.0))-(1.0/(8.0*k+5.0))-(1.0/(8.0*k+6.0))));
  16.         System.out.println(pi);
  17.        
  18.     }
  19.     }
  20. }
Add Comment
Please, Sign In to add comment