gogllottery.blogg.se

Java program to calculate pi
Java program to calculate pi







java program to calculate pi

NewPi = newPi - (4/newFooter) + (4/(newFooter+2)) ("Do you want to continue calculating ? Y/N ? ")

java program to calculate pi

("How many times do you want to calculate to PI ? ")

java program to calculate pi

Static Scanner myInput = new Scanner(System.in) So far so good.however there seems to be a problem with the code.Įxample the first time I enter 3.calculation runs, I respond y and enter 3 again => calculation continues => OK BUT when first time I enter 3, calculations runs, I respond y and enter for example 100.the values are being calculation but go under 3.14. If he responds with Y or y the program has to check what the last previous calculated value was and has to continue again from that new value.again the user gets the question how many times from there on there has to be calculated to PI. At the end of the first while loop, a question is shown to the user if he wants to continue. The bigger the number, the closer the calculation gets to PI. This program asks the user to input a number on to how many times there has to be a calculation to PI. In have never programmed before in my life, so keep that in mind :-) I started with the online youtube tutorials from Derek Banas and now I am trying to create my own little program. Ok so since last week I started learning a little bit of Java.









Java program to calculate pi