+ 1
3rd Apr 2019, 8:33 PM
Unemployed Visionary.
6 odpowiedzi
+ 5
Because the first condition is true. All other else statements will be skipped after a condition is found to be true
3rd Apr 2019, 8:43 PM
jay
jay - avatar
+ 2
"else if" is only executed, when "if" is false. Since 10 is smaller than 20 and 10 is greater than 6 the "if" is true and no other statement in the "if"-statement are checked. Please use proper tags: Included the programming language in the tags. Do not use unneccessary tags like "help" and "asap"
3rd Apr 2019, 8:45 PM
sneeze
sneeze - avatar
+ 2
https://code.sololearn.com/cy6OIsZ3cEQD/?ref=app Thanks for the help I also have query on the above code.
3rd Apr 2019, 8:47 PM
Unemployed Visionary.
+ 2
//sneeze //jay Thank you,guys for helping me out its quite generous of you. Regarding the double post.I am sorry as I am new to this forum,so I'm not familiar with the protocols. I respect your decision I will not do that again.
3rd Apr 2019, 9:08 PM
Unemployed Visionary.
+ 2
Keep coding. Keep asking. Keep learning. That is why we mention it.
3rd Apr 2019, 9:10 PM
sneeze
sneeze - avatar
+ 1
Please start a new thread for every question if num==3 the code will executes continue; Continue jumps out of the while and does not decrease num-- So num stays 3 It comes in another iteration and the same repeats. Here you have created a infinite loops Personally I do not use continue because of this behaviour. You can do this with just for-loops, while-loops and if-statement if (num == 3) { num--; //decraese num before continue continue; } I do prefer this one if (num != 3) { printf("%d\n",num); }
3rd Apr 2019, 9:01 PM
sneeze
sneeze - avatar