-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLargest.java
More file actions
30 lines (23 loc) · 879 Bytes
/
Largest.java
File metadata and controls
30 lines (23 loc) · 879 Bytes
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
// ACB-CondOp/Largest.java
// Taha Burak Sahin PJATK
import java.util.Scanner;
import java.util.Locale;
public class Largest {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
scan.useLocale(Locale.US);
System.out.print(
"Enter three numbers (with " +
"DOT as dec. separator!) -> ");
var a = scan.nextDouble();
var b = scan.nextDouble();
var c = scan.nextDouble();
var largest = b > a ? b : a;
largest = c > largest ? c : largest;
var smallest = b < a ? b : a;
smallest = c < smallest ? c : smallest;
System.out.println("Number " + largest + " is " +
"the largest and " + smallest +
" is the smallest");
}
}