Home > Back-end >  C loop small problems
C loop small problems

Time:09-18

Want to ask these few questions trouble, is how to do ah

CodePudding user response:

The switch after the execution will perform the following case

CodePudding user response:

Because there is no break the back of the case, the

CodePudding user response:

(5) because there is no break, will continue to run down, not out of the switch to determine
(2) the first enter whilen=9, perform n -, n=8
The second n=8, n, n=7
The third time n=7, n, n=6
Fourth, does not meet the conditions, exit
(4) the practice of using the same as the first (2)
I (in judgment) s
0 0
1 0 + 1
2 0 + 1 + 3
3 0 + 1 + 3
4 0 + 1 + 3 + 5
5 0 + 1 + 3 + 5
6 0 + 1 + 3 + 5 + 7
7 (=7) exit loop
S=16

  • Related