AcWing 614. 最大值 Java
原题链接
中等
作者:
zshzsh
,
2024-03-04 20:41:34
,
所有人可见
,
阅读 14
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int b = sc.nextInt();
int c = sc.nextInt();
int d;
if(max(a,b)>max(a,c)){
if(max(a,b)>max(b,c)){
d = max(a,b);
}else {
d = max(b,c);
}
}else {
if(max(a,c)>max(b,c)){
d = max(a,c);
}else {
d = max(b,c);
}
}
System.out.println(d + " eh o maior");
}
public static int max(int a, int b){
if(a>b){
return a;
}else {
return b;
}
}
}