运算代码
<script>
var sum = 0;
for (var i = 1; i <= 100; i++) {
sum = sum + i;//循环计算
}
var avg = sum / 100;//循环计算
console.log(avg);//循环打印
</script>
运行结果
<script>
var sum = 0;
for (var i = 1; i <= 100; i++) {
sum = sum + i;//循环计算
}
var avg = sum / 100;//循环计算
console.log(avg);//循环打印
</script>