Curly brackets after for statement

前端 未结 4 1531
渐次进展
渐次进展 2021-01-16 16:35

I\'m a newbie. Wrote a code to print sum of number from 1 to 10. Here\'s what happened;

for(a = 1; a<=10; a++)
sum += a;
cout<
<
4条回答
  •  天涯浪人
    2021-01-16 17:04

    Because the code in curly braces is executed until the condition in for loop becomes false.

提交回复
热议问题