RTriangle
Code
import java.util.Scanner;
public class RTriangle
{
public static void main( String[] args )
{
Scanner keyboard = new Scanner(System.in);
int num, num1, num2;
System.out.println( " Hello please enter 3 integers " );
System.out.println(" Side 1: " );
num = keyboard.nextInt();
System.out.println(" Side 2: " );
num1 = keyboard.nextInt();
System.out.println(" Side 3: " );
num2 = keyboard.nextInt();
while ( num > num1 )
{
System.out.println( " Sorry sir but " + num1 + " is smaller than " + num + " TRY AGAIN " );
num1 = keyboard.nextInt();
}
while ( num > num2 )
{
System.out.println( " Sorry sir but " + num2 + " is smaller than " + num + " TRY AGAIN " );
num2 = keyboard.nextInt();
}
while ( num1 > num2 )
{
System.out.println( " Sorry sir but " + num2 + " is smaller than " + num1 + " TRY AGAIN " );
num2 = keyboard.nextInt();
}
System.out.println(" your sides " + num +" " + num1 + " " + num2 );
if ( num < num1 && num < num2 && num1 < num2 )
{
System.out.println(" Yes these make a right triangle " );
}
else
{
System.out.println( " no these do not make a right triangle " );
}
}
}
RTriangle