package Code428;

import java.util.Scanner;

public class CodeScannerMax {

public static void main(String[] args) {
//从键盘输入三个数字
Scanner scanner =new Scanner(System.in);
int a=scanner.nextInt();
int b=scanner.nextInt();
int c =scanner.nextInt();
//使用三元运算符 a大于b,如果大于则 temp=a,否则temp=b;

int temp = a>b?a:b;
int max = c>temp?c:temp;
System.out.println("最大值"+max);
}
}
运行代码↓
JAVA 三元运算符 求最大值

 

 

相关文章:

  • 2021-12-13
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-27
  • 2022-01-31
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-05-19
  • 2022-12-23
  • 2021-11-28
  • 2021-12-21
  • 2021-11-20
  • 2021-12-19
相关资源
相似解决方案