解题思路:
max=((x>y?x:y)>z)?(x>y?x:y):z;
注意事项:
参考代码:
import java.util.Scanner;
public class MaxDemo {
public static int Max(int x,int y,int z) {
int max=0;
max=((x>y?x:y)>z)?(x>y?x:y):z;
return max;
}
public static void main(String[] args) {
// TODO Auto-generated method stub
int a,b,c;
System.out.print("请输入三个整数:");
Scanner scan = new Scanner(System.in);
a = scan.nextInt();
b = scan.nextInt();
c = scan.nextInt();
System.out.print(Max(a,b,c));
}
}
0.0分
0 人评分