Question: make sure it's in JAVA Write a program that will find the value of PI iteratively. Print the number of iterations and the seconds it

 make sure it's in JAVA Write a program that will find make sure it's in JAVA

Write a program that will find the value of PI iteratively. Print the number of iterations and the seconds it took to find the result. You should be able to change the number of iterations. (More iterations will take more time to calculate obviously) PI=3.1415922535897423 after 2500000 iterations It took 0.021 seconds to complete this operation You can use any algorithm you like as long as it is an iterative algorithm. The most well-known one is the Leibniz formula for PI. 1 - 1/3 + 1/5 - 1/7 + 1/9 - ... = pi/4. Using summation notation: sigma^infinity_n=0 (-1)^n/2n + 1 = pi/4. For calculating the time, you can use System.nanoTime() method. We had an example of it in the Repetition.java program in the instructor's lecture content

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!