//Input a positive integer x and enter 1-2+3-4+5-6+...Find the minimum n value that becomes +n>x
It's been a week since I started... Please reply.c
There are no questions in the questionnaire and there are no question marks, so I don't know what to "answer" you. Perhaps the question (i.e., agony and embarrassment) is, "Why doesn't this code end and keep running?
break doesn't get caught and the answer doesn't print out! What should I do?"I know… I understand that you say it's been a week since you started something.
To get right to the conclusion, you can change the order. Set
if(b>x) to the first if in
If you think about it carefully,
a%2 is always
0. There are no exceptions. (Why there are no exceptions is omitted due to the need to explain the secondary mathematical dimension) So the current if-elseif-elseif control always falls to the first or second quarter and never falls to the third quarter. That's why I don't ride
break and go around the infinite loop. If you change the order,
b>x can be true or false, so if it is false, then you will move on to examining
Did the (I guessed) question answer?
© 2022 pinfo. All rights reserved.