Hi everyone,
If you have successfully completed this task - can you please share your solution and explain the logic you thought of?
I just can't understand how to approach this task.
Thank you!
I need to understand the logic for solving this problem
Under discussion
Comments (2)
- Popular
- New
- Old
You must be signed in to leave a comment
Attila
24 February 2020, 19:55
0
Attila
24 February 2020, 19:55useful
Use:
t = t % 5;
This gives you the remainder after dividing by 5. Since 5 Minutes is the whole Cycle of red, yellow green, the remainder is enough to decide which light should be on.
+1