Home > Back-end >  Could you tell me a great god why output result what also have no
Could you tell me a great god why output result what also have no

Time:02-06

CodePudding user response:

Dead cycle, jump out the for loop, nature is not perform printf,

I=1; Meet the I & lt;=101, then the sum=sum + I;
Then the second time, I=(2 * I) - 1; I=(2 * 1) - 1=1; This time is back to the first step,
So I have been 1, no more than 101, nature will not jump out of the loop,

CodePudding user response:

I=(2 * I) - 1, equal to 1 at the beginning, I perform this sentence after or equal to 1, the infinite loop

CodePudding user response:

Are you require all the odd and less than 101? Can change to the for (I=0; I & lt;=101; I +=2)

CodePudding user response:

death cycle!

CodePudding user response:

Debugging debugging debugging

CodePudding user response:

references a white steamed bread reply: 3/f
are you require all the odd and less than 101? Can change to the for (I=0; I & lt;=101; I +=2)

Excuse me I +=2 is what mean

CodePudding user response:

refer to 6th floor qq_53918454 response:
Quote: refer to the third floor a white steamed bun response:
are you require all the odd and less than 101? Can change to the for (I=0; I & lt;=101; I +=2)

Excuse me I +=2 is what mean ah

Well,,,, is equivalent to I=I + 2,
  • Related