PINK JS循环案列
作者:互联网
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 += '标签:PINK,money,sum,案列,alert,score,str,var,JS
来源: https://blog.csdn.net/Gnat_/article/details/120694259