FastFoodCoding

Login


Connect with one of the following accounts





Login

Please wait while we redirect...

Views: 33   



Following program shows you how to take a number as input and calculate the square root of given number.
In this program we get input from user and calculate square root using Math.sqrt() method

using System;

public class squareroot
    {
        public static void Main(String[] args
        )
        {
          Console.WriteLine("Enter a Number : ");
          double input = Convert.ToDouble(Console.ReadLine());
          double result = Math.Sqrt(input);
          Console.WriteLine("Input: " + input);
          Console.WriteLine("Square root of " + input + " is: " + result);

        }
    }

Output:

Enter a Number : 
 16
Input: 16
Square root of 16 is: 4



On By


Top Tutorials

Top Questions

Top Articles

Top Blogs

Top News