C# - I need to create a program to calculate square roots without using Math.sqrt or any square root method (or math library).

Hi! I don't really get how should I do it then. Can someone help me with that? I just began to learn C#. Thank you in advance!

10/19/2019 3:10:55 PM

DIY Mods

3 Answers

New Answer


1. Start with an arbitrary positive start value x (the closer to the root, the better). a) You could start with x=n, but you can easily do better than that. 2) Initialize y = 1. 3) Loop until desired approximation is achieved: a) Get the next approximation for root using average of x and y b) Set y = n/x If I explain it this way does it make it easier to solve the problem DIY Mods?


Based on the description, you just need to know the algorithm you'll need to solve this. You'll find that here: https://wikipedia.org/wiki/Babylonian_method


@Ace Thanks for the response! I saw several methods like Babylonian, but I have no idea how to put those formulas in code. I would trougly appreciate any help.