5个数求最值
来源:互联网 发布:魅族网络运营商呈灰色 编辑:程序博客网 时间:2024/04/28 00:30
5个数求最值
时间限制:1000 ms | 内存限制:65535 KB
难度:1
- 描述
- 设计一个从5个整数中取最小数和最大数的程序
- 输入
- 输入只有一组测试数据,为五个不大于1万的正整数
- 输出
- 输出两个数,第一个为这五个数中的最小值,第二个为这五个数中的最大值,两个数字以空格格开。
- 样例输入
1 2 3 4 5
- 样例输出
1 5
package nyist.base;import java.util.Scanner;public class Main31 {public static void main(String[] args) {int[] src = getInput();int min = src[0];int max = src[0];for(int j = 1; j < src.length;j++){//System.out.print(src[j]+" ");if(min > src[j]){min = src[j];}if(max < src[j]){max = src[j];}}System.out.println(min);System.out.println(max);}public static int[] getInput(){Scanner scanner = new Scanner(System.in);int [] input = new int[5];for(int i =0 ; i < 5;i++){input[i] = scanner.nextInt();}return input;}}
- 5个数求最值
- NYOJ - 5个数求最值
- 5个数求最值
- 5个数求最值
- 5个数求最值
- 5个数求最值
- 5个数求最值
- 5个数求最值
- 5个数求最值
- NYOJ31 5个数求最值
- 5个数求最值
- (31)5个数求最值
- 5个数求最值
- 31 5个数求最值
- nyoj 5个数求最值
- NYOJ-5个数求最值
- 5个数求最值
- NYoj-5个数求最值
- 【如何解决电脑没了声音的问题】
- 报表软件等同于BI软件吗?
- Linux服务器是否被攻击怎么判断
- Java连接、操作Oracle 10g 数据库
- 【XP系统开机登录界面如何禁止】
- 5个数求最值
- string.Split(params char[])”最匹配的重载方法具有一些无效参数
- 【显卡问题快速解决方案】
- 4.x 如何处理Power按键
- Playing with ptrace, Part II
- Linux系统怎么搭建Linux日志服务器
- Qt example之Joke for Android( make for my honey)
- 【修炼四】技术预研
- Python语言和print版本说明