Assignemnt #75

Code

///colin hinton
///5th period
///Right
///Right.java
///11/16/2015

import java.util.Scanner;

class Right
{
    public static void main ( String [] args)
    {
        Scanner keyboard = new Scanner(System.in);
        
        int one,two,three;
        
        System.out.println("Enter the three sides of the triangle");
        System.out.print("Side one : ");
        one = keyboard.nextInt();
        System.out.print("Side two : ");
        two = keyboard.nextInt();
        while ( two < one)
        {
            System.out.println("Sorry " + two + " is smaller than " + one + " please try again");
            two = keyboard.nextInt();
        }
        System.out.print("Side three : ");
        three = keyboard.nextInt();
        while ( three < two )
        {
            System.out.println("Sorry " + three + " is smaller than " + two + " please try again");
            three = keyboard.nextInt();
        }
        if ( (one * one) + (two * two) == ( three * three) )
        {
            System.out.println("These sides make a right triangle.");
        }
        else 
        System.out.println("These sides do not make a right triangle");
    }
}

    

Picture of the output

Assignment 1