How to solve the problem of adding one demerit point after every 5 km speed? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 2

How to solve the problem of adding one demerit point after every 5 km speed?

Write a function for checking the speed of drivers. this function should have one parameter:speed. If speed is less than 70,it should print "ok". Otherwise, for every 5km above the speed limit(70), it should give the driver one demerit point and print the total number of demerit points. For eg. if the speed is 80, it should print "points:2" If the driver gets more than 12 points, the function should print:"license suspended". I beg u to solve this question.

5th Apr 2019, 8:57 PM
Yog Sharma
Yog Sharma - avatar
3 Answers
+ 8
Have you tried to do something ? Please try to write a code, even if you don't know much and it doesn't work, post it here, and then we'll help you to get it right.
5th Apr 2019, 11:10 PM
Cépagrave
Cépagrave - avatar
0
Any answers for this? Im struggling for this question too.
29th May 2019, 4:41 PM
NastyNash
NastyNash - avatar
- 1
I can solve your problem using JavaScript or C++
5th Apr 2019, 9:31 PM
Juan David Padilla Diaz
Juan David Padilla Diaz - avatar