试题 算法提高 选最大数

题目描述
  输入3个整数a、b、c,(数的范围是[1,10000])输出其中最大的数。(用指针实现)
样例输入
2 5 1
样例输出
5

资源限制
时间限制:1.0s 内存限制:512.0MB

代码块

import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		int a1 = sc.nextInt();
		int a2 = sc.nextInt();
		int a3 = sc.nextInt();
		
		System.out.println(Math.max(a1, Math.max(a2, a3)));
	}
}

在这里插入图片描述

发布了86 篇原创文章 · 获赞 3 · 访问量 1386

猜你喜欢

转载自blog.csdn.net/wnamej/article/details/105445638
今日推荐