-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMaxFunction.java
More file actions
25 lines (20 loc) · 548 Bytes
/
MaxFunction.java
File metadata and controls
25 lines (20 loc) · 548 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
import java.util.Scanner;
public class Calculate {
// 삼항 연산자 사용
public static int max(int a, int b) {
return (a > b) ? a : b;
}
public static int function(int a, int b, int c) {
int result = max(a, b);
result = max(result, c);
return result;
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int b = sc.nextInt();
int c = sc.nextInt();
System.out.printf("(%d,%d,%d)중 가장 큰 수는 : %d 입니다.", a, b, c, function(a, b, c));
sc.close();
}
}