Maha

Maha

  • NA
  • 0
  • 328.2k

C# class name problem

Mar 21 2007 5:24 PM

If I use Math as a class name return should be System.Math.Sqrt(num); in order to program to give output.

If I am not using Math as a class name return can be Math.Sqrt(num); in order to program to give output.

Please explain

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)

{

return System.Math.Sqrt(num);

}

}

/*

Number = 81

Square Root of the number = 9

Press any key to continue

*/


Answers (2)