- minutes = remaining / 60;
- seconds = remaining % 60;
- sprintf (prompt, "%02d:%02d ", minutes, seconds);
+ if (remaining > 0) {
+ minutes = remaining / 60;
+ seconds = remaining % 60;
+ sprintf (prompt, "%02d:%02d ", minutes, seconds);
+ } else {
+ printf ("Time's up.\a\n");
+ sprintf (prompt, "> ");
+ time_limit_seconds = 0;
+ }