package 复习题;
import java.util.Scanner;
public class 复习题八 {
/**
* @param 编写一个程序
* 程序接收键盘上输入的三个数,并输出这三个数的最大数。
*/
public static void main(String[] args) {
// TODO 键盘输入
Scanner input = new Scanner(System.in);
// 定义变量保存最大的数字
int max = 0;
// 循环遍历3个数字,并动态赋值
for (int i = 1; i <= 3; i++) {
System.out.println("请你输入第" + i + "个数字 :");
int a = input.nextInt();
// 对max进行最大化赋值
if (a > max) {
max = a;
}
}
System.out.println("三个数中最大的数是 :" + max);
}
}