- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLarger_Number.java
More file actions
Latest commit
26 lines (19 loc) · 555 Bytes
/
Copy pathLarger_Number.java
File metadata and controls
26 lines (19 loc) · 555 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
importjava.util.Scanner;
publicclassLarger_Number {
publicstaticvoidmain(String[] args) {
Scannerscanner = newScanner(System.in);
System.out.print("Enter first number: ");
intnum1 = scanner.nextInt();
System.out.print("Enter second number: ");
intnum2 = scanner.nextInt();
System.out.println("Larger number is: " + findLarger(num1, num2));
scanner.close();
}
publicstaticintfindLarger(intnum1, intnum2) {
if (num1 > num2) {
returnnum1;
} else {
returnnum2;
}
}
}