CJCoding With Joseph
15free / daySign inCreate account

If: Speed Cap

The 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 — print one after the last line.

Hints3 available
Topics:
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.