Home > Back-end >  Great god help explain this problem
Great god help explain this problem

Time:11-21

CodePudding user response:


In your mind can conceive the program execution flow
Step 1: I=1, x=1, I=2, y=2, I=3
Step 2: I=2, I=3, y=5, I=4
Step 3: I=5, x=6, I=6, 11, y=I=7
Step 4: I=8, 9, I=y=20, I=9
Output:
8 and 20

CodePudding user response:

refer to the second floor ysy_blog response:

In your mind can conceive the program execution flow
Step 1: I=1, x=1, I=2, y=2, I=3
Step 2: I=2, I=3, y=5, I=4
Step 3: I=5, x=6, I=6, 11, y=I=7
Step 4: I=8, 9, I=y=20, I=9
Output:
8 and 20

X +=I, followed by a comma

CodePudding user response:

Pay attention to x +=I, i++;

CodePudding user response:

The answer is 9 1 to 20

CodePudding user response:

This topic need an attention is the comma, a statement is a semicolon, so is not a statement, in front of comma separated so if (I % 2) after the statements with a semicolon,

CodePudding user response:

reference weixin_45434440 reply: 3/f
Quote: refer to the second floor ysy_blog response:

In your mind can conceive the program execution flow
Step 1: I=1, x=1, I=2, y=2, I=3
Step 2: I=2, I=3, y=5, I=4
Step 3: I=5, x=6, I=6, 11, y=I=7
Step 4: I=8, 9, I=y=20, I=9
Output:
8 and 20

X +=I, followed by a comma

Well, see, this writing code method is easy to be wrong
  • Related