I modified C# "Math" Program according to suggestion but it is not working. Please correct it.
If one entered a number, squre root of that number should be the output. That means for example: If I entered 10 as a input, output should be 3.1622.
square root of 10 = 3.1622.
using
System;
public
class Math
{
public static void Main()
{
double sqrt, number;
string sNum;
Console.Write("Number = ");
sNum = Console.ReadLine();
number = Convert.ToDouble(sNum);
sqrt = SqrtRoot(number);
Console.WriteLine("Square Root of the number = {0}", sqrt);
}
public static double SqrtRoot(double num)
{
double sRoot;
sRoot = Math.Sqrt(num);
return sRoot;
}
}