Learning by doing: Reading books and trying to understand the (code) examples
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

39 lines
449 B

#include <stdio.h>
#define MIN_PER_HOUR 60
unsigned getMinutes(void);
int main (void) {
unsigned min;
min = getMinutes();
while (min != 0) {
printf("%u minutes are %u:%02u HH:MM\n", min, min/MIN_PER_HOUR, min % MIN_PER_HOUR);
min = getMinutes();
}
return 0;
}
unsigned getMinutes(void) {
unsigned min;
printf("Time in minutes (0 to quit): ");
if (scanf("%u", &min) != 1) {
min = 0;
}
return min;
}