-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprogram15.java
More file actions
40 lines (27 loc) · 890 Bytes
/
Copy pathprogram15.java
File metadata and controls
40 lines (27 loc) · 890 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
31
32
33
34
35
36
37
38
39
40
// Create a method that finds the maximum among three numbers.
import java.util.Scanner;
class Finder{
public String max(int a, int b, int c){
if (a>b && a>c) {
return "A is Maximum.";
}else if(b>c){
return "B is Maximum.";
}else{
return "C is Maximum.";
}
}
}
public class program15 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.print("Enter Num A : ");
int numA = sc.nextInt();
System.out.print("Enter Num B : ");
int numB = sc.nextInt();
System.out.print("Enter Num C : ");
int numC = sc.nextInt();
Finder obj = new Finder();
String result = obj.max(numA, numB, numC);
System.out.println(result);
}
}