Prog 74: Safe Square Root
///Name: Ilana Levy
///Period: 5
///Program Name: Safe Square Root
///File Name: squareRoot.java
///Date Finished: 9/24/2015
import java.util.Scanner;
public class squareRoot
{
public static void main( String[] args )
{
Scanner keyboard = new Scanner( System.in) ;
int number;
double ans;
System.out.println( "SQUARE ROOT!" );
do
{
System.out.print( "Enter a number: " );
number = keyboard.nextInt();
ans = Math.sqrt( number );
if ( number < 0 )
System.out.println( " You can't take the square root of a negative number." );
else
System.out.println( "The square root of " + number + " is " + ans );
} while ( number < 0 );
}
}