var q = [45,12,20,31,75,9,51,91];

var w = 0;

for(var i = 0; i <= q.length - 1; i++){

    w += q [i];


}

console.log("相加等于:"+w);

var p = w / q.length;

console.log("平均值等于:" + p);

2023-06-29T04:18:12.png