To calculate Square root of a number there is a inbuilt function inside the Math class. So you can directly use this function to find out the Square root of a number.
C# Program to Calculate Square Root of a Number
using System;
using System.Text;
using System.Collections;
using System.Data;
namespace Console_App
{
public class clsFactorial
{
public static void Main()
{
try
{
Console.WriteLine("Enter a number for Square Root:");
int Number =Convert.ToInt16( Console.ReadLine());
double SqrtNumber = Math.Sqrt(Number);
Console.WriteLine("Square root of Number {0} is: {1}", Number, SqrtNumber);
}
catch(Exception ex)
{
//handle exception here
}
Console.ReadLine();
}
}
}
ur facebook link CShatpHub.com wrong r as a t
ReplyDelete