-
Notifications
You must be signed in to change notification settings - Fork 0
/
Q_13.java
46 lines (34 loc) · 1.01 KB
/
Q_13.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
// Muhammad Naveed
// (Sides of a Triangle) Write an application that reads three
// nonzero values entered by the user and determines and prints
// whether they could represent the sides of a triangle.
import java.util.Scanner;
public class Q_13
{
public static void main(String[] args)
{
// sides of the triangle
int sideA, sideB, sideC;
// scanner object
Scanner sc = new Scanner(System.in);
// taking input
System.out.print("Enter first side : ");
sideA = sc.nextInt();
// taking input
System.out.print("Enter second side : ");
sideB = sc.nextInt();
// taking input
System.out.print("Enter third side : ");
sideC = sc.nextInt();
// closing the scanner
sc.close();
if (sideA == sideB & sideA == sideC & sideC == sideB)
{
System.out.println("Could be a triangle");
}
else
{
System.out.println("Not a triangle");
}
}
}