"Write a program that inputs an integer for n , iterates through the Babylonian algo. until guess is within 1% of the previous guess and outputs the answer as double"
Thats the question for my assignment . I just want to know how to print out guess is within 1% of the previous guess . Thanks in advanced .
I'm not really sure how it works but I would do something like this:
1. Divide the guess and previous guess by the total number( Say the guess can only go up to 1000)
2. Take the absolute value of ( guess - previous ).
3. Multiple the answer by 100. ( Turn it into a percent )
4. Check to see if the answer is less than one using an if statement.
You can try something like this but it might not work.