1. Welcome to PHCorner Forums. Take a moment to Sign up and gain unlimited access and extra privileges that guests are not entitled to, such as:

    All that and more! Registration is quick, simple and absolutely free. Join our community today!

To find square root of the number

Discussion in 'Coding, Programming' started by Bhadz141, Sep 23, 2016.

  1. import java.util.Scanner;
    public class Program
    public static void main(String[] args) {
    double number;

    Scanner input = new Scanner(System.in);

    System.out.println("Enter a number to find its square root: ");
    number = input.nextDouble();

    System.out.println("Square root of "+ (int)number + " is: "+ Math.sqrt(number));
  2. Xifu

    Xifu Honorary Poster Established

    Thanks for the info on how to use to Math.sqrt() function. :)
Tags / Keywords:

Share This Page