-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathranking.java
More file actions
46 lines (32 loc) · 1.04 KB
/
ranking.java
File metadata and controls
46 lines (32 loc) · 1.04 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
import java.util.Scanner;
public class ranking{
public static void main(String[] args) {
int smallest;
Scanner input= new Scanner(System.in);
System.out.println("Enter first number: ");
int n1=input.nextInt();
System.out.println("Enter second number: ");
int n2=input.nextInt();
System.out.println("Enter third number: ");
int n3=input.nextInt();
if((n1<n2) &&( n1<n3)){
if(n2<n3){
System.out.println("n1<n2<n3");}
else {
System.out.println("n1<n3<n2");
}
} else if ((n2<n3)&&(n2<n1)) {
if(n1<n3){
System.out.println("n2<n1<n3");}
else{
System.out.println("n2<n3<n1");
}
} else if ((n3<n2)&&(n3<n1)) {
if (n1<n2){
System.out.println("n3<n1<n2");}
else{
System.out.println("n3<n2<n3");
}
}
}
}