-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlargest_no.java
More file actions
34 lines (30 loc) · 1.03 KB
/
Copy pathlargest_no.java
File metadata and controls
34 lines (30 loc) · 1.03 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
// package java.loops concept.questions;
import java.util.Scanner;
public class largest_no {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int a = in.nextInt();
int b = in.nextInt();
int c = in.nextInt();
// int max = a;
// if (b > max) {
// max = b;
// }
// if (c > max) {
// max = c;
// }
// System.out.println(max + " is the largest number");
// int max = Math.max(a, b);
// max = Math.max(max, c);
// System.out.println(max + " is the largest number");
int max = Math.max(c, Math.max(a, b));
System.out.println(max + " is the largest number");
// if (a >= b && a >= c) {
// System.out.println(a + " is the largest number");
// } else if (b >= a && b >= c) {
// System.out.println(b + " is the largest number");
// } else {
// System.out.println(c + " is the largest number");
// }
}
}