用javascript编写一段程序,计算1到1000之间所有整数的和,并显示结果.

学习 时间:2026-03-30 13:45:58 阅读:4470
用javascript编写一段程序,计算1到1000之间所有整数的和,并显示结果.

最佳回答

独特的冷风

深情的水杯

2026-03-30 13:45:58

function getR(a,b){
var s = 0;
while(b>=a){
s = b--+s;
}

return s;
}
document。write(getR(1,1000))

最新回答共有2条回答

  • 纯真的大神
    回复
    2026-03-30 13:45:58

    function getR(a,b){ var s = 0; while(b>=a){ s = b--+s; } return s;}document。write(getR(1,1000))

上一篇 1.75乘(2除以7)等于?

下一篇 洗碗机功率一般多少瓦