-
Notifications
You must be signed in to change notification settings - Fork 0
/
RightTriangleChecker.java
72 lines (59 loc) · 2.33 KB
/
RightTriangleChecker.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import java.util.Scanner;
public class RightTriangleChecker {
public static void main(String[]args)
{
Scanner input = new Scanner(System.in);
System.out.println("Enter three integers:");
int count = 0;
System.out.print("Side 1:");
int syd1 = input.nextInt();
System.out.print("Side 2:");
int syd2 = input.nextInt();
System.out.print("Side 3:");
int syd3 = input.nextInt();
System.out.println("Your three sides are " + syd1 + " " + syd2 + " " + syd3);
System.out.println("These sides *do* make a triangle. Yippy-skippy!");
while(count == 1)
{
System.out.print("Side 1:");
syd1 = input.nextInt();
System.out.print("Side 2:");
syd2 = input.nextInt();
System.out.print("Side 3:");
syd3 = input.nextInt();
}
if(syd3 < syd2 && syd2 < syd1)
{
System.out.println("Your three sides are " + syd1 + " " + syd2 + " " + syd3);
System.out.println("These sides *do* make a triangle. Yippy-skippy!");
if(syd2 < syd1)
{
System.out.println(syd2 + " is smaller than " + syd1 + "." + " Try again.");
System.out.print("Side 2:");
syd2 = input.nextInt();
if(syd2 > syd1)
{
System.out.print("Side 3:");
syd3 = input.nextInt();
System.out.println("Your three sides are " + syd1 + " " + syd2 + " " + syd3);
System.out.println("These sides *do* make a triangle. Yippy-skippy!");
}
}
if(syd3 < syd2)
{
System.out.println(syd3 + " is smaller than " + syd2 + "." + " Try again.");
System.out.print("Side 3:");
syd3 = input.nextInt();
if(syd3 > syd2)
{
System.out.println("Your three sides are " + syd1 + " " + syd2 + " " + syd3);
System.out.println("These sides *do* make a triangle. Yippy-skippy!");
}
}
else
{
System.out.println(" ");
}
}
}
}