zoukankan      html  css  js  c++  java
  • java练习篇 求输出最大值

    总结:没有把数据输入。是数组-----把要输入的数据放在数组里。错在这里

    import java.util.Scanner;
    
    public class shibai {
    
    	public static void main(String[] args) {
    		Scanner c = new Scanner(System.in);
    		int a[] = new int[5];
    		int max = a[0];
    		for (int i = 0; i < a.length; i++) {
    			System.out.println("请输入" + "第" + (i + 1) + "个数");
    			a[i] = c.nextInt();
    			if (max < a[i]) {
    				max = a[i];
    			}
    		}
    		System.out.println("笨蛋结果是:" + max);
    	}
    }
    

      

  • 相关阅读:
    Mysql探索之索引详解,又能和面试官互扯了~
    POJ 1163
    POJ 1157
    POJ 1143
    POJ 1164
    HDU 2553
    POJ 1321
    POJ 1125
    POJ 2488
    POJ 3083
  • 原文地址:https://www.cnblogs.com/langlove/p/3405793.html
Copyright © 2011-2022 走看看