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

学习 时间:2026-10-24 14:54:16 阅读:7283
用javascript编写一段程序,计算1到1000之间所有整数的和,并显示结果.

最佳回答

大方的硬币

失眠的冷风

2026-10-24 14:54:16

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

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

最新回答共有2条回答

  • 落寞的大雁
    回复
    2026-10-24 14:54:16

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

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

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