-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsorting.java
More file actions
31 lines (29 loc) · 1.02 KB
/
sorting.java
File metadata and controls
31 lines (29 loc) · 1.02 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
import java.util.Scanner;
public class sorting {
public static void main(String[] args) {
int x,y,z;
Scanner inp = new Scanner(System.in);
System.out.println("first number:");
x = inp.nextInt();
System.out.println("second number:");
y = inp.nextInt();
System.out.println("third number:");
z = inp.nextInt();
if (x >= y) {
if (y >= z)
System.out.print("In order " + z + " " + y + " " + x);
else if (z >= x)
System.out.print("In order " + y + " " + x + " " + z);
else if (x >= z)
System.out.print("In order " + y + " " + z + " " + x);
} else {
if (z >= y)
System.out.print("In order " + x + " " + y + " " + z);
else if (z >= x)
System.out.print("In order " + x + " " + z + " " + y);
else if (x >= z)
System.out.print("In order " + z + " " + x + " " + y);
}
inp.close();
}
}