-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathThreeIntegers.java
59 lines (30 loc) · 1.24 KB
/
ThreeIntegers.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
import java.util.Scanner;
public class ThreeIntegers {
public static void main(String[]args) {
Scanner input = new Scanner(System.in);
System.out.print(" Enter first three digit number ");
int firstNumber = input.nextInt();
System.out.print("Enter second three digit number ");
int secondNumber = input.nextInt();
System.out.print(" Enter third three digit number ");
int thirdNumber = input.nextInt();
if(firstNumber > secondNumber && secondNumber > thirdNumber){
System.out.printf("%d %d %d",thirdNumber, secondNumber, firstNumber);
}
if(firstNumber > thirdNumber && thirdNumber > secondNumber){
System.out.printf("%d %d %d",secondNumber, thirdNumber, firstNumber);
}
if(secondNumber > firstNumber && firstNumber > thirdNumber) {
System.out.printf("%d %d %d", thirdNumber, firstNumber, secondNumber);
}
if(secondNumber >thirdNumber && thirdNumber > firstNumber) {
System.out.printf("%d %d %d",firstNumber, thirdNumber, secondNumber);
}
if(thirdNumber > firstNumber && firstNumber > secondNumber) {
System.out.printf("%d %d %d",secondNumber, firstNumber, thirdNumber);
}
if(thirdNumber > secondNumber && secondNumber > firstNumber) {
System.out.printf("%d %d %d",firstNumber, secondNumber, thirdNumber);
}
}
}