linux-sysprog · beginner · ~15 min
Compute a countdown without underflow.
Implement int alarm_remaining(int set_seconds, int elapsed) returning how many seconds are left before an alarm fires (never negative).
int alarm_remaining(int set_seconds, int elapsed) {
/* TODO */
return 0;
}
Solve this exercise in the browser editor — compile and run against the test harness, no setup required.