C# Program to find the square root of a number


In this program, You will learn how to find the square root of a number in C#.


Math.Sqrt(num);

Example: How to find the square root of a number in C#.

using System;
public class Program
{
	public static void Main(string[] args)
	{
		int x;

		Console.Write("Enter a number:");
		x = Convert.ToInt32(Console.ReadLine());

		Console.WriteLine("Square root is:" + Math.Sqrt(x));

	}
}

Output:

Enter a number:49
Square root is:7