-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPractical_05.java
More file actions
45 lines (41 loc) · 1.15 KB
/
Practical_05.java
File metadata and controls
45 lines (41 loc) · 1.15 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
/* Question := Write a program that prompts the user to enter three integers and display
the maximum number among these numbers. */
import java.util.Scanner;
public class Practical_05 {
static void maxNo(int a, int b, int c) {
if(a > b) {
if(a > c) {
System.out.println(a + " is Maximum.");
}
else{
System.out.println(c + " is Maximum.");
}
}
else if(a < b) {
if(b > c) {
System.out.println(b + " is Maximum.");
}
else {
System.out.println(c + " is Maximum.");
}
}
else{
System.out.println("All are Same.");
}
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Enter Three Numbers := ");
int a = sc.nextInt();
int b = sc.nextInt();
int c = sc.nextInt();
maxNo(a,b,c);
}
}
/* Output :=
Enter Three Numbers :=
23
65
12
65 is Maximum.
*/