計算陣列 總和 int sum=0; for (int i=0;i<a.length;i++){ sum=sum+a[i]; } //計算平均值 System.out.printf("平均值為: %.2f", (double)sum/n); }
確定! 回上一頁