Tuesday, September 8, 2020

JAVA Program | Square root of input number using Sqrt Method | Diploma Computer Engineering

 

//JAVA Program to find Square Root of Input Number

package Diploma;

import java.util.Scanner;

/**

 *

 * @author Ashok Roshan

 */

public class Squareroot1 

{

   public static void main(String args[]) {

       Scanner scanner = new Scanner(System.in);

        System.out.println("Enter number to find square root in Java : ");

        double square = scanner.nextDouble();

        double squareRoot = Math.sqrt(square);

        System.out.printf("Square root of number: "+square+" is "+ squareRoot);

   

    }

}


/*

Output

Enter number to find square root in Java : 

9

Square root of number: 9.0 is 3.0BUILD SUCCESSFUL (total time: 3 seconds)

*/

No comments:

Post a Comment

Computer Objective Questions || Practice Set || Shishu Varg || Class 4 & 5

1) What is the first mechanical calculating device of the world? Answer:- Abacus Q2) Who is Know as the world's First Programmer...