WSQ13. Babylonian method

For this wsq I had to create a program that asks the user for a floating point or integer number and returns the square root of the number.

The challenge of the program was to perform this task without using the mathematic function for the square root, so, using a bunch of loops we could first give an approximation of the square root of the number, then, getting the average between the approximation and the number divided by the approximation, we get a new aproximation, and we keep doing the same proccess until the new approximation is equal to the last one. There is when we have found our square root of the number provided.

Here is the code for my program: https://github.com/Manuelmv94/TC1014/blob/master/wsq13.py

CC BY 4.0 WSQ13. Babylonian method by Manuel Madrigal is licensed under a Creative Commons Attribution 4.0 International License.

Comments are closed.