-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsortnumber.java
More file actions
47 lines (34 loc) · 1.27 KB
/
sortnumber.java
File metadata and controls
47 lines (34 loc) · 1.27 KB
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
import java.util.Scanner;
public class sortnumber {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.println("Please input num1");
int input1 = input.nextInt();
System.out.println("Please input num2");
int input2 = input.nextInt();
System.out.println("Please input num3");
int input3 = input.nextInt();
if (input1 >= input2) {
if (input2 >= input3) {
System.out.println(input3+" "+input2+" "+input1);
}
else if (input3 >= input1) {
System.out.println(input2+" "+input1+" "+input3);
}
else if (input1 > input3){
System.out.println(input2+" "+input3+" "+input1);
}
}
if (input2 > input1) {
if (input3 >= input2) {
System.out.println(input1+" "+input2+" "+input3);
}
else if (input3 >= input1) {
System.out.println(input1+" "+input3+" "+input2);
}
else if (input1 > input3) {
System.out.println(input3+" "+input1+" "+input2);
}
}
}
}