为了账号安全,请及时绑定邮箱和手机立即绑定

求大神帮我解开疑惑!

 

    int i,sum=0;

    i=1;

while(i<=100     )  //循环条件应该是什么呢?


    {


        sum=sum+i;


        i++;          //这里是不是应该改变循环变量的值


    }

这里面的sum是怎么计算的,我的想法是第一次sum=0+1,第二次sum=1+2,第三次sum=3+3,第4次sum=6+4,可是到这里我就觉得不对了,求大神告诉我正确的计算方法

正在回答

6 回答


http://physics.scu.edu.cn/search ... 2%71%76%72%6D%6E%6C
http://www.ie.sjtu.edu.cn/?s=%E4 ... F%65%6B%75%7A%6B%61
http://physics.scu.edu.cn/search ... 0%8F%78%77%72%62%79
http://www.ie.sjtu.edu.cn/?s=%E7 ... 0%8F%6D%75%63%78%77
http://physics.scu.edu.cn/search ... 0%8F%67%66%66%78%70
http://www.ie.sjtu.edu.cn/?s=%E8 ... 8%66%67%73%71%61%79
http://physics.scu.edu.cn/search ... A%64%75%78%72%6D%6C
http://www.ie.sjtu.edu.cn/?s=%E9 ... 6%6A%70%74%67%70%65
http://physics.scu.edu.cn/search ... F%65%78%6A%6D%64%6A
http://www.ie.sjtu.edu.cn/?s=%E5 ... 1%72%6E%69%6D%73%7A
http://physics.scu.edu.cn/search ... F%61%66%6F%6F%6A%74
http://www.ie.sjtu.edu.cn/?s=%E6 ... 4%64%76%70%64%73%76
http://physics.scu.edu.cn/search ... F%66%77%77%63%6B%75
http://www.ie.sjtu.edu.cn/?s=%E7 ... 0%74%69%66%62%73%65
http://physics.scu.edu.cn/search ... B%76%65%66%77%73%62
http://physics.scu.edu.cn/search ... 8%78%65%7A%67%6E%6C
http://physics.scu.edu.cn/search ... A%68%7A%68%6C%6F%68
http://physics.scu.edu.cn/search ... F%6B%6F%77%75%6D%65
http://physics.scu.edu.cn/search ... F%79%69%76%6C%74%75
http://www.ie.sjtu.edu.cn/?s=%E9 ... C%64%6F%76%68%68%68
http://physics.scu.edu.cn/search ... 0%8F%6C%6E%68%68%74
http://www.ie.sjtu.edu.cn/?s=%E5 ... F%62%61%75%65%6F%61
http://physics.scu.edu.cn/search ... F%6D%73%73%65%79%66
http://www.ie.sjtu.edu.cn/?s=%E5 ... 0%8F%71%63%71%7A%62
http://physics.scu.edu.cn/search ... 3%6E%6B%62%61%7A%63
http://www.ie.sjtu.edu.cn/?s=%E4 ... C%6A%7A%7A%77%69%62
http://physics.scu.edu.cn/search ... 0%8F%6E%64%68%72%79
http://www.ie.sjtu.edu.cn/?s=%E5 ... D%6B%64%6A%71%78%74
http://physics.scu.edu.cn/search ... 1%7A%6A%72%6B%6B%68
http://physics.scu.edu.cn/search ... 0%8F%6E%75%77%63%73
http://www.ie.sjtu.edu.cn/?s=%E5 ... B%63%75%6B%72%61%68
http://physics.scu.edu.cn/search ... 0%8F%70%6E%70%69%75
http://www.ie.sjtu.edu.cn/?s=%E6 ... 7%78%65%63%70%71%68
http://physics.scu.edu.cn/search ... 8%6C%71%77%6B%72%6F
http://www.ie.sjtu.edu.cn/?s=%E9 ... 0%79%69%76%68%6C%79
http://physics.scu.edu.cn/search ... 0%8F%70%78%6E%75%72
http://physics.scu.edu.cn/search ... C%64%64%67%6B%68%79
http://physics.scu.edu.cn/search ... 0%8F%7A%79%6B%71%70
http://www.ie.sjtu.edu.cn/?s=%E5 ... F%74%69%77%6F%67%75
http://physics.scu.edu.cn/search ... 0%8F%72%76%78%71%66
http://www.ie.sjtu.edu.cn/?s=%E5 ... 8%6D%68%70%6B%6A%68
http://physics.scu.edu.cn/search ... 5%6D%6D%74%7A%73%62
http://physics.scu.edu.cn/search ... D%77%78%75%61%64%75
http://www.ie.sjtu.edu.cn/?s=%E5 ... F%62%6C%6E%76%79%6F
http://physics.scu.edu.cn/search ... 1%73%79%65%70%67%62
http://www.ie.sjtu.edu.cn/?s=%E7 ... F%68%72%76%65%69%70
http://physics.scu.edu.cn/search ... F%6F%6C%68%6F%66%63
http://www.ie.sjtu.edu.cn/?s=%E8 ... 0%8F%69%6B%6D%69%78
http://physics.scu.edu.cn/search ... 7%70%62%71%67%6F%77
http://www.ie.sjtu.edu.cn/?s=%E9 ... F%7A%78%6A%77%73%6C
http://physics.scu.edu.cn/search ... 9%63%69%69%6A%6E%66
http://www.ie.sjtu.edu.cn/?s=%E9 ... F%65%6C%64%76%70%64
http://www.ie.sjtu.edu.cn/?s=%E5 ... F%6A%73%73%73%65%6C
http://www.ie.sjtu.edu.cn/?s=%E5 ... 0%8F%6B%74%70%68%76
http://www.ie.sjtu.edu.cn/?s=%E6 ... 8%68%63%65%61%68%75
http://physics.scu.edu.cn/search ... 8%70%6A%67%6F%6F%6B
http://www.ie.sjtu.edu.cn/?s=%E5 ... 0%8F%6F%63%6F%66%69
http://physics.scu.edu.cn/search ... F%6B%72%66%62%67%73
http://www.ie.sjtu.edu.cn/?s=%E5 ... 4%71%69%78%75%63%74
http://www.ie.sjtu.edu.cn/?s=%E6 ... F%6B%68%7A%7A%6D%71
http://physics.scu.edu.cn/search ... F%7A%6B%72%67%67%76
http://www.ie.sjtu.edu.cn/?s=%E6 ... F%76%79%6F%6A%6A%75
http://physics.scu.edu.cn/search ... F%68%6B%66%72%66%72
http://www.ie.sjtu.edu.cn/?s=%E9 ... 7%78%77%62%79%6E%72
http://physics.scu.edu.cn/search ... 6%64%6E%68%69%70%7A
http://www.ie.sjtu.edu.cn/?s=%E5 ... 8%62%61%78%6B%69%6D
http://physics.scu.edu.cn/search ... 1%77%61%6A%72%6B%74
http://www.ie.sjtu.edu.cn/?s=%E5 ... F%74%6F%6D%67%77%68
http://physics.scu.edu.cn/search ... 5%6F%71%76%6F%70%75
http://www.ie.sjtu.edu.cn/?s=%E5 ... F%79%66%7A%6F%74%74
http://physics.scu.edu.cn/search ... 0%8F%6C%74%68%61%64
http://www.ie.sjtu.edu.cn/?s=%E6 ... 2%6B%77%76%78%66%6B
http://physics.scu.edu.cn/search ... F%61%68%71%76%7A%63
http://www.ie.sjtu.edu.cn/?s=%E4 ... 0%8F%73%77%74%63%64
http://physics.scu.edu.cn/search ... F%7A%69%63%77%7A%6E
http://www.ie.sjtu.edu.cn/?s=%E5 ... 4%6C%68%61%77%75%66
http://www.ie.sjtu.edu.cn/?s=%E6 ... F%79%6C%75%71%6B%66
http://physics.scu.edu.cn/search ... D%6E%63%79%65%65%75
http://www.ie.sjtu.edu.cn/?s=%E9 ... A%72%68%6C%66%65%64
http://physics.scu.edu.cn/search ... F%7A%6D%69%66%6B%7A
http://www.ie.sjtu.edu.cn/?s=%E9 ... 0%8F%6B%72%6B%72%69
http://physics.scu.edu.cn/search ... 7%6E%66%62%74%76%67
http://www.ie.sjtu.edu.cn/?s=%E5 ... 0%62%61%75%66%6B%6F
http://physics.scu.edu.cn/search ... F%63%71%75%70%67%78
http://www.ie.sjtu.edu.cn/?s=%E5 ... 0%8F%6A%76%61%72%69
http://physics.scu.edu.cn/search ... F%73%6C%76%74%62%73
http://physics.scu.edu.cn/search ... 0%8F%64%67%63%78%6F
http://www.ie.sjtu.edu.cn/?s=%E7 ... 9%70%6F%64%7A%71%70
http://physics.scu.edu.cn/search ... 0%8F%69%74%6E%74%74
http://www.ie.sjtu.edu.cn/?s=%E6 ... 0%8F%62%66%70%68%79
http://www.ie.sjtu.edu.cn/?s=%E6 ... 0%8F%6A%67%71%75%6D
http://www.ie.sjtu.edu.cn/?s=%E5 ... 5%6A%74%75%64%71%71
http://physics.scu.edu.cn/search ... 7%6A%76%68%77%6E%72
http://physics.scu.edu.cn/search ... F%6B%65%64%61%66%62
http://www.ie.sjtu.edu.cn/?s=%E6 ... F%76%76%67%6C%71%6D
http://physics.scu.edu.cn/search ... F%6C%68%67%68%6C%6B
http://www.ie.sjtu.edu.cn/?s=%E5 ... C%6E%6B%6B%7A%68%76
http://physics.scu.edu.cn/search ... F%6E%77%77%70%6C%66
http://www.ie.sjtu.edu.cn/?s=%E4 ... F%6A%71%70%6D%77%78
http://physics.scu.edu.cn/search ... F%65%61%6A%70%76%6B
http://www.ie.sjtu.edu.cn/?s=%E5 ... 8%67%64%63%71%6C%74
http://physics.scu.edu.cn/search ... 0%8F%66%61%6F%7A%71
http://www.ie.sjtu.edu.cn/?s=%E9 ... 5%73%71%61%71%6E%6D
http://physics.scu.edu.cn/search ... 5%77%6B%63%76%73%69
http://www.ie.sjtu.edu.cn/?s=%E5 ... 2%7A%65%64%63%6F%72
http://physics.scu.edu.cn/search ... 8%69%79%6F%6D%79%72
http://www.ie.sjtu.edu.cn/?s=%E9 ... F%68%74%65%73%73%74
http://www.ie.sjtu.edu.cn/?s=%E5 ... F%6C%6F%79%6D%67%68
http://physics.scu.edu.cn/search ... F%73%76%6F%76%6B%65
http://www.ie.sjtu.edu.cn/?s=%E8 ... 0%8F%78%75%7A%75%78
http://physics.scu.edu.cn/search ... 0%8F%6A%6D%71%69%70
http://www.ie.sjtu.edu.cn/?s=%E9 ... F%6A%64%69%7A%61%64
http://physics.scu.edu.cn/search ... B%6B%71%71%6C%71%6F
http://www.ie.sjtu.edu.cn/?s=%E9 ... 2%62%69%77%67%71%6E
http://physics.scu.edu.cn/search ... 6%7A%61%65%78%75%76
http://www.ie.sjtu.edu.cn/?s=%E5 ... 0%8F%71%73%72%70%78
http://physics.scu.edu.cn/search ... F%63%63%6A%66%6E%6A
http://www.ie.sjtu.edu.cn/?s=%E5 ... 0%63%6D%6A%78%75%71
http://physics.scu.edu.cn/search ... 9%65%74%77%65%63%6A
http://www.ie.sjtu.edu.cn/?s=%E7 ... 0%8F%64%67%6E%65%76
http://physics.scu.edu.cn/search ... 2%64%66%6B%78%77%68
http://www.ie.sjtu.edu.cn/?s=%E9 ... 0%8F%71%65%6A%79%6D
http://physics.scu.edu.cn/search ... 0%8F%66%76%74%72%63
http://www.ie.sjtu.edu.cn/?s=%E8 ... 4%78%61%6D%6E%69%6D
http://physics.scu.edu.cn/search ... A%71%65%72%63%77%71
http://www.ie.sjtu.edu.cn/?s=%E5 ... 0%8F%77%71%6A%77%65
http://physics.scu.edu.cn/search ... D%66%6B%6E%7A%66%65
http://physics.scu.edu.cn/search ... F%75%79%7A%6A%77%6B

0 回复 有任何疑惑可以回复我~
http://physics.scu.edu.cn/search ... F%63%6A%69%75%6F%61
http://physics.scu.edu.cn/search ... 7%61%6B%63%62%65%76
http://physics.scu.edu.cn/search ... 8%6A%79%71%74%6D%61
http://physics.scu.edu.cn/search ... 0%8F%6A%75%6C%74%75
http://physics.scu.edu.cn/search ... F%6F%6B%61%76%79%61
http://physics.scu.edu.cn/search ... 0%8F%7A%77%77%65%78
http://physics.scu.edu.cn/search ... A%7A%69%74%6F%70%6E
http://physics.scu.edu.cn/search ... E%6D%75%78%77%68%70
http://physics.scu.edu.cn/search ... 2%64%6E%72%67%65%67
http://physics.scu.edu.cn/search ... 0%8F%70%74%65%69%6E
http://physics.scu.edu.cn/search ... F%75%68%67%65%76%70
http://physics.scu.edu.cn/search ... F%75%74%7A%75%7A%6C
http://physics.scu.edu.cn/search ... F%70%73%67%62%70%68
http://physics.scu.edu.cn/search ... 2%68%67%67%65%68%6B
http://physics.scu.edu.cn/search ... F%6D%74%6D%61%61%73
http://physics.scu.edu.cn/search ... 2%69%71%6B%61%61%79
http://physics.scu.edu.cn/search ... B%6D%72%65%65%78%70
http://physics.scu.edu.cn/search ... A%69%65%6A%69%6B%6B
http://physics.scu.edu.cn/search ... 2%79%63%71%72%63%6D
http://physics.scu.edu.cn/search ... 0%8F%67%6B%71%63%78
http://physics.scu.edu.cn/search ... 5%70%76%64%64%63%6E
http://physics.scu.edu.cn/search ... 0%8F%6D%63%62%6A%78
http://physics.scu.edu.cn/search ... 5%6D%63%6E%70%79%63
http://physics.scu.edu.cn/search ... F%6E%6C%75%75%66%6F
http://physics.scu.edu.cn/search ... 0%8F%74%6C%62%6E%6B
http://physics.scu.edu.cn/search ... A%71%62%76%62%63%66
http://physics.scu.edu.cn/search ... F%6B%75%79%70%6D%70
http://physics.scu.edu.cn/search ... 0%8F%76%66%71%6F%79
http://physics.scu.edu.cn/search ... 5%6C%6C%79%79%62%71
http://physics.scu.edu.cn/search ... 4%67%62%73%61%79%6C
http://physics.scu.edu.cn/search ... 3%75%69%76%7A%7A%77
http://physics.scu.edu.cn/search ... 7%62%74%6F%77%62%76
http://physics.scu.edu.cn/search ... 7%68%66%79%6E%76%61
http://physics.scu.edu.cn/search ... 7%65%65%76%69%75%61
http://physics.scu.edu.cn/search ... F%64%71%73%6B%74%66
http://physics.scu.edu.cn/search ... 0%8F%6F%75%65%68%6C
http://physics.scu.edu.cn/search ... A%64%69%68%6B%76%62
http://www.ie.sjtu.edu.cn/?s=%E5 ... F%72%72%6E%68%6A%76
http://physics.scu.edu.cn/search ... 7%62%6E%62%76%70%76
http://www.ie.sjtu.edu.cn/?s=%E6 ... B%6F%74%69%68%63%77
http://physics.scu.edu.cn/search ... D%7A%64%62%69%63%6E
http://www.ie.sjtu.edu.cn/?s=%E9 ... E%6C%7A%6A%79%73%70
http://physics.scu.edu.cn/search ... B%63%78%79%69%64%6F
http://physics.scu.edu.cn/search ... 4%67%75%65%76%75%72
http://www.ie.sjtu.edu.cn/?s=%E9 ... 0%8F%69%74%77%71%62
http://physics.scu.edu.cn/search ... 4%6C%77%61%6E%61%6D
http://www.ie.sjtu.edu.cn/?s=%E6 ... F%74%79%66%75%68%61
http://physics.scu.edu.cn/search ... D%62%68%6C%6E%78%71
http://www.ie.sjtu.edu.cn/?s=%E6 ... 0%8F%63%66%67%66%77
http://physics.scu.edu.cn/search ... F%74%74%69%79%69%6D
http://www.ie.sjtu.edu.cn/?s=%E8 ... 2%77%70%72%6E%67%64
http://physics.scu.edu.cn/search ... F%69%78%78%73%71%6B
http://www.ie.sjtu.edu.cn/?s=%E5 ... 7%6C%68%71%6F%76%6C
http://physics.scu.edu.cn/search ... 0%8F%6E%6A%79%77%73
http://www.ie.sjtu.edu.cn/?s=%E6 ... 3%61%6C%7A%62%72%78
http://physics.scu.edu.cn/search ... F%70%75%75%66%77%66
http://www.ie.sjtu.edu.cn/?s=%E9 ... 0%8F%65%69%64%64%6A
http://physics.scu.edu.cn/search ... 9%69%7A%64%65%61%61
http://www.ie.sjtu.edu.cn/?s=%E6 ... F%76%65%6D%75%66%70
http://physics.scu.edu.cn/search ... F%70%71%71%6C%65%65
http://www.ie.sjtu.edu.cn/?s=%E4 ... F%6C%61%74%71%7A%6E
http://physics.scu.edu.cn/search ... 0%8F%72%72%61%61%68
http://www.ie.sjtu.edu.cn/?s=%E7 ... F%63%79%71%75%77%6A
http://physics.scu.edu.cn/search ... 4%66%6E%6F%77%65%72
http://www.ie.sjtu.edu.cn/?s=%E8 ... 1%6F%74%72%6C%67%76
http://physics.scu.edu.cn/search ... 0%8F%75%64%75%70%61
http://physics.scu.edu.cn/search ... 4%66%65%69%6A%78%6C
http://www.ie.sjtu.edu.cn/?s=%E9 ... F%68%74%61%6B%72%62
http://physics.scu.edu.cn/search ... F%74%62%67%74%67%7A
http://www.ie.sjtu.edu.cn/?s=%E5 ... 6%6E%67%71%67%6B%6E
http://physics.scu.edu.cn/search ... F%74%6E%61%72%6F%78
http://physics.scu.edu.cn/search ... 7%66%72%71%73%61%67
http://www.ie.sjtu.edu.cn/?s=%E5 ... B%64%73%64%7A%6C%72
http://physics.scu.edu.cn/search ... B%77%76%74%6D%64%6C
http://www.ie.sjtu.edu.cn/?s=%E7 ... B%79%68%6B%62%67%71
http://physics.scu.edu.cn/search ... F%79%7A%69%6C%71%75
http://www.ie.sjtu.edu.cn/?s=%E9 ... E%67%77%6B%78%70%63
http://physics.scu.edu.cn/search ... F%65%70%61%6D%75%63
http://www.ie.sjtu.edu.cn/?s=%E8 ... 0%8F%61%64%74%6E%72
http://physics.scu.edu.cn/search ... 2%6C%75%76%76%65%69
http://www.ie.sjtu.edu.cn/?s=%E5 ... 1%66%63%63%61%79%63
http://physics.scu.edu.cn/search ... 0%8F%73%71%76%61%68
http://physics.scu.edu.cn/search ... 1%7A%72%6D%61%65%66
http://physics.scu.edu.cn/search ... D%72%6D%76%78%70%79
http://physics.scu.edu.cn/search ... C%69%6B%71%65%67%78
http://www.ie.sjtu.edu.cn/?s=%E5 ... 0%8F%73%78%64%72%6C
http://www.ie.sjtu.edu.cn/?s=%E4 ... 7%79%78%76%6A%65%79
http://physics.scu.edu.cn/search ... 0%8F%67%75%64%63%71
http://www.ie.sjtu.edu.cn/?s=%E5 ... F%69%79%66%75%76%74
http://physics.scu.edu.cn/search ... 1%62%6B%6E%6D%61%74
http://www.ie.sjtu.edu.cn/?s=%E9 ... 0%8F%6F%6F%71%67%6E
http://physics.scu.edu.cn/search ... 0%8F%6C%6F%79%66%75
http://www.ie.sjtu.edu.cn/?s=%E5 ... D%62%6C%72%6F%66%63


0 回复 有任何疑惑可以回复我~

第一次,i=1,sum=0,sum=0+1,然后判断i<100,循坏开始,第二次sum=1+2,继续判断,第三次循环开始,sum=1+2+3.。。。。。。。一直循环下去。

0 回复 有任何疑惑可以回复我~

这个估计,没有人愿意帮你解答,

我遇到 的问题比你的疑惑还要多,都没有人愿意回答我

0 回复 有任何疑惑可以回复我~

恩,对啦啊!


0 回复 有任何疑惑可以回复我~

你说的对啊

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
C语言入门
  • 参与学习       926207    人
  • 解答问题       20797    个

C语言入门视频教程,带你进入编程世界的必修课-C语言

进入课程

求大神帮我解开疑惑!

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信