-
Notifications
You must be signed in to change notification settings - Fork 0
/
ascending_descending_num.java
55 lines (55 loc) · 1.56 KB
/
ascending_descending_num.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
import java.util.*;
/**
* Write a description of class ascending_descending_num here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class ascending_descending_num
{
public static void main(){
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int b = sc.nextInt();
int c = sc.nextInt();
if(a>b&&a>c){
System.out.print(a+" ");
if(b>c){
System.out.print(b+" ");
System.out.println(c+" ");
System.out.println(c +" "+ b +" "+ a);
}
else{
System.out.print(c+" ");
System.out.println(b+" ");
System.out.println(b +" "+ c +" "+ a);
}
}
if(b>a&&b>c){
System.out.print(b +" ");
if(a>c){
System.out.print(a+" ");
System.out.println(c+" ");
System.out.println(c +" "+ a +" "+ b);
}
else{
System.out.print(c+" ");
System.out.println(a+" ");
System.out.println(a +" "+ c +" "+ b);
}
}
if(c>b&&c>a){
System.out.print(c+" ");
if(b>a){
System.out.print(b+" ");
System.out.println(a+" ");
System.out.println(a +" "+ b +" "+ c);
}
else{
System.out.print(a+" ");
System.out.println(b+" ");
System.out.println(b +" "+ a +" "+ c);
}
}
}
}