If: Speed Cap
easyQuestion 198The variable speed holds a car's speed. Write an if statement that lowers speed to 120 whenever it is above 120, so that it never exceeds the limit. After the if statement, print Speed: followed by the final value. An if statement does not have to print anything; here it only changes a variable.
Expected output
Speed: 120= newline. The output ends with a newline, so 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.