-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDay-03-Java-Q18
More file actions
65 lines (46 loc) · 1.28 KB
/
Copy pathDay-03-Java-Q18
File metadata and controls
65 lines (46 loc) · 1.28 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/*Riya wants to find the greatest of three numbers.could you please help her to find the greatest of three numbers that implements in programming.
Input Format
Input consists of three integer.
Constraints
No Constraints
Output Format
print the greatest of three Number.
Sample Input 0
10
20
30
Sample Output 0
Number3 is maximum with value of 30.0
Sample Input 1
5
6
6
Sample Output 1
Number3 is maximum with value of 6.0
Sample Input 2
7
8
5
Sample Output 2
Number2 is maximum with value of 8.0*/
#Answer
import java.util.*;
public class Solution {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
double num1 = sc.nextDouble();
double num2 = sc.nextDouble();
double num3 = sc.nextDouble();
if (num3 >= num1 && num3 >= num2) {
System.out.println("Number3 is maximum with value of " + num3);
}
else if (num2 >= num1 && num2 >= num3) {
System.out.println("Number2 is maximum with value of " + num2);
}
else {
System.out.println("Number1 is maximum with value of " + num1);
}
sc.close();
/* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */
}
}