Sponsored Ad

Friday, September 10, 2010

C# Program to Calculate Square Root of a Number

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

 

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();           
        }
    }
}

1 comment:

  1. ur facebook link CShatpHub.com wrong r as a t

    ReplyDelete

Sponsored Ad

Development Updates