-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathMethods.java
More file actions
26 lines (22 loc) · 747 Bytes
/
Copy pathMethods.java
File metadata and controls
26 lines (22 loc) · 747 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
import java.util.Scanner;
public class Methods {
public static void main(String[] args) {
max_no();
}
static void max_no() {
Scanner sc = new Scanner(System.in);
System.out.print("Enter first no: ");
int num1 = sc.nextInt();
System.out.print("Enter second no: ");
int num2 = sc.nextInt();
System.out.print("Enter third no: ");
int num3 = sc.nextInt();
if (num1>num2 && num1 > num3) {
System.out.println(num1 + " is the greatest");
} else if (num2>num3 && num2>num1) {
System.out.println(num2 + " is the greatest");
}
else
System.out.println(num3 + " is the greatest");
}
}