var classNum = prompt(“请输入班级总人数:”);
var score = 0;
var sum = 0;
var average = 0;
for (var i = 1; i <= classNum; i++) {
score = prompt(‘请输入第’ + i + ‘个学生的成绩:’);
sum += parseInt(score);
}
average = sum / classNum;
alert(‘班级总成绩是’ + sum);
alert(‘班级平均成绩是’ + average + ‘。’);
打印倒三角
var str = '';
for (var i = 1; i <= 10; i++) {
for (var j = 11 - i; j >= 1; j--) {
str += '