Minutes and Seconds, With the 60 Given a Name
EasyRead a whole number of seconds from standard input and report it as minutes and seconds, using / for the quantity and % for the leftover. Give the 60 a name instead of scattering it: declare const int seconds_per_minute = 60; and use that name everywhere the number is needed, so the compiler will stop you if you ever try to reassign it. Declare total_seconds as an int initialized to 0, and print scanf's conversion count first, as the previous exercise did. The last line multiplies the whole minutes back out by seconds_per_minute, which is the invariant (a / b) * b + a % b == a made visible. Watch the negative test case: division truncates toward zero and the remainder takes the sign of the dividend, so -428 seconds comes out as -7 minutes and -8 seconds rather than anything a human would say.
Success Criteria
Your code must pass 3 test case(s) to complete this exercise. 3 hint(s) are available if you need help.
Sign in to track your progress
You can work on exercises as a guest, but sign in to track your progress and save your submissions.