Write a program that prompts the user for a value greater than 10 as an input (you should loop
until the user enters a valid value) and finds the square root of that number and the square root of
the result, and continues to find the square root of the result until we reach a number that is
smaller than 1.01. The program should output how many times the square root operation was
performed.
import java.util.Scanner;
publicclass SkrtProgram
{
publicstaticvoid main(String[] args)
{
Scanner scan = new Scanner(System.in);
System.out.println("Lets find the sq root of a value greater than 10");
String garbage ="";
while(true)
{
System.out.println("Enter a number a number greater than 10 ");
if(scan.hasNextDouble()){
double skrt = scan.nextDouble();
if (skrt > 10){
//input is good;
System.out.println("output is " + skrt);
break;
}
}
garbage = scan.nextLine(); //throw out the line
}//end first while loop
}
}
Im only able to find the square of number greater than 10 i need another while loop for square root of the results and I can't figure out how to
" continues to find the square root of the result until we reach a number that is
smaller than 1.01. The program should output how many times the square root operation was
performed".