置顶

计数循环的三个问题

翁恺 发表于02月17日
<p style="outline: none; font-family: Arial, &#39;Hiragino Sans GB&#39;, &#39;Microsoft YaHei&#39;, 微软雅黑, Helvetica, sans-serif; white-space: pre-wrap;">如果把视频中的while做的计数循环改成do-while了,那三个问题的答案还一样么?</p><p><code class="brush:java;toolbar:false">int&nbsp;count&nbsp;=&nbsp;10; do&nbsp;{ &nbsp;&nbsp;&nbsp;&nbsp;System.out.println(count); &nbsp;&nbsp;&nbsp;&nbsp;count&nbsp;=&nbsp;count&nbsp;-1; }&nbsp;while&nbsp;(count&gt;0); System.out.println(&quot;发射!&quot;);</code></p><ol class=" list-paddingleft-2" style="list-style-type: decimal;"><li><p>这个循环需要执行多少次?</p></li><li><p style="outline: none;">循环停下来的时候,有没有输出最后的0?</p></li><li><p style="outline: none;">循环结束以后,count的值是多少?</p></li></ol><p><br/></p>
43 回复
点击加载更多