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 + "\n最大值为:" + max); } }