數組中的和

package com.cetc55;

public class Dome4 {
	public static void main(String[] args) {
		int num = 0;
		int[] array = { 14, 124, 141, 24, 14, 124, 14, 1, 4 };
		for (int i = 0; i < array.length; i++) {
			if (array[i] > i) {
				num+=array[i];
			}
			System.out.println(array.length);
		}
		System.out.println("數組中的和爲:" + num);
	}
}


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章