Assignment 75, Right Triangle Checker
Code
///Name: Stella Koliavas
///Period: 5
///File Name: triChecker.java
///Date Finshed: 2/4/16
import java.util.Scanner;
public class TriChecker
{
public static void main(String[] args)
{
Scanner siri = new Scanner(System.in);
int A, B, C, AandB2;
System.out.println("Enter 3 intergers to make a triangle, they HAVE to be entered in acsending order");
System.out.print("Side A: ");
A = siri.nextInt();
do
{
System.out.print("Side B: ");
B = siri.nextInt();
}while (A > B);
do
{
System.out.print("Side C: ");
C = siri.nextInt();
}while (B > C);
if (B < C)
{{
System.out.println("Your 3 sides are " + A +", "+ B +", "+ C + ".");
AandB2 = ((A*A)+(B*B));
}
if (AandB2==C*C)
System.out.println("Your sides make a right triangle YAY!");
if (AandB2!=C*C)
System.out.println("Your sides do NOT make a right triangle!");
}
}
}
Picture of the output