//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