Ask your own question, for FREE!
Computer Science 9 Online
OpenStudy (anonymous):

please , help me .. how can i solve this attachment by Java program?

OpenStudy (anonymous):

OpenStudy (anonymous):

@zepdrix @Nnesha

OpenStudy (anonymous):

class PiEst{ public static void main(String args[]){ float calc = m(201); System.out.println( calc + "\n"); } public static float m (int i){ float addPI = 0; for (int j = 1; j<=i; j++){ addPI +=(Math.pow((-1),(j+1))) /((2*j) -1); } return 4*addPI; } }

OpenStudy (anonymous):

table class PiEst{ public static void main(String args[]){ float calc =0; for(int i = 0; i<10; i++){ calc = m(i); System.out.println( i+"\t\t"+calc + "\n"); } } public static float m (int i){ float addPI = 0; for (int j = 1; j<=i; j++){ addPI +=(Math.pow((-1),(j+1))) /((2*j) -1); } return 4*addPI; } }

OpenStudy (anonymous):

this will be calculate the PI of numbers less than 10 .. and we need it calculate the PI for ( 1,101,201,301,401,501,601) , i have not find the equation which do it

OpenStudy (anonymous):

@SolomonZelman @ParthKohli

OpenStudy (anonymous):

make a few modification to the code. change the number. instead of incrementing the loop by 1, you can have the loop increment by 100. like this for(int i = 1; i<=601; i+=100){ //do some stuff }

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!