zoukankan      html  css  js  c++  java
  • java练习,,,从键盘输入次数,输出最大值,和

    总结;你的关注,是我的动力

    package com.b;
    
    import java.util.Scanner;
    
    public class YUIO {
    	public static void main(String[] args) {
    		Scanner c = new Scanner(System.in);
    		int x = c.nextInt();
    		int a[] = new int[x];
    		int s = 0;
    		int max = a[0];
    		for (int i = 0; i < x; i++) {
    			System.out.println("输入的" + "第" + (i + 1) + "个数");
    			a[i] = c.nextInt();
    			s += a[i];
    			if (max < a[i]) {
    				max = a[i];
    			}
    		}
    		System.out.println("总和为:" + s + "
    最大值为:" + max);
    	}
    
    }
    

      

  • 相关阅读:
    LeetCode 55
    LeetCode 337
    LeetCode 287
    LeetCode 274
    LeetCode 278
    LeetCode 264
    LeetCode 189
    LeetCode 206
    LeetCode 142
    LeetCode 88
  • 原文地址:https://www.cnblogs.com/langlove/p/3407720.html
Copyright © 2011-2022 走看看