Check Speed Limit Warning
This problem is based on a very common driving check. You have the current speed of a car and the speed limit for that road, and you need to decide which message should be shown.
If the car is within the limit, the message should be OK. If the car is going over the limit, the message should be SLOW DOWN.
For example, if the speed is 60 and the limit is 50, the answer is SLOW DOWN. But if the speed is 45 and the limit is 50, the answer is OK.
So the task is to compare two numbers and return the message that matches the situation.
Example Input & Output
Matching the limit is still allowed.
The speed is still within the allowed limit.
The speed is above the limit, so a warning is needed.
Algorithm Flow

Solution Approach
A good way to solve this is to use one simple comparison.
First, read the two values: the current speed and the speed limit. After that, you only need to check whether the speed is greater than the limit.
The condition is:
If that condition is true, then the driver is over the limit, so you print SLOW DOWN.
If that condition is false, then the speed is still allowed, so you print OK.
This problem is really just one decision, which is why it works well as a quick practice exercise for conditionals.
Best Answers
Solutions Coming Soon
Verified best solutions for this Challenge are still being analyzed and will be available soon.
Comments (0)
Join the Discussion
Share your thoughts, ask questions, or help others with this Challenge.
