资源限制
时间限制:1.0s 内存限制:256.0MB
问题描述
编写一个程序,输入10个数,确定和打印其中最大数
输入格式
输入1行,包括10个数
输出格式
输出1行,输出10个数中的最大数
样例输入
1 2 3 4 5 6 7 8 9 10
样例输出
10
数据规模和约定
输入数据约定为整形数据
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int max=-Integer.MAX_VALUE;
for(int x=0;x<10;x++) {
int num=sc.nextInt();
if(max<num)
max=num;
}
System.out.println(max);
}
}