Question: In this method i am trying to read from standard input a double-precision floating-point positive number (type double) and writes to standard output its square
In this method i am trying to read from standard input a double-precision floating-point positive number (type double) and writes to standard output its square root, to the nearest integer rounded down, as an integer (no decimal places). You may NOT, however use the method Math.sqrt(). This is what i have at the moment but not sure how to finish it or if im doing it right.
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
double number = sc.next();
int squareNumber =
System.out.println(sqauerNumber);
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
