snipplets.dev/code/C/seconds_to_minutes_and_hours.c

12 lines
261 B
C
Executable File

#include <stdio.h>
int main(int argc, char const *argv[]) {
unsigned int seconds = 800000 + 61;
unsigned int minutes = seconds / 60;
unsigned int hours = minutes / 60;
printf("H: %d\nM: %d\nS: %d\n", hours, minutes % 60, seconds % 60);
return 0;
}