using System; class Square_Root { static void Main(string[] args) { double a, root; do { Console.Write("Enter a number: "); a = Convert.ToDouble(Console.ReadLine()); if (a < 0) Console.WriteLine("Please enter a positive number!"); } while (a < 0); root = a / 2; double root_old; do { root_old = root; root = (root_old + a / root_old) / 2; } while (Math.Abs(root_old - root) > 1.0E-6); Console.WriteLine("The square root of " + a + " is " + root); root = Square_Root_Class.calcRoot(a); Console.WriteLine("The square root of " + a + " is " + root); } }