← Back to If Statements
Question 201
Three Independent Ifs, Then Done
Three Independent Ifs, Then Done
The variable x is 50. Write three separate if statements (not an else-if chain) that check, in this order: whether x is exactly 50, whether x is greater than 10, and whether x is less than 10. Each true check prints its own line:Equals 50,Greater than 10andLess than 10. After all three ifs, printDone. Only the checks that are true print, so the output has three lines here.
Expected Output:
Equals 50 Greater than 10 Done
= newline. The output ends with a newline — print one after the last line.
Hints3 available
Sign in to use hintsTopics:
If Statements
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (clog, fn, fori)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.