Skip to content

Instantly share code, notes, and snippets.

@awesmubarak
Last active May 31, 2022 12:51
Show Gist options
  • Save awesmubarak/52f764fde51ed32f8f106e16aa881b59 to your computer and use it in GitHub Desktop.
Save awesmubarak/52f764fde51ed32f8f106e16aa881b59 to your computer and use it in GitHub Desktop.
#include <stdio.h>
char* solution(int T) {
int h, m, s;
char *time_str;
h = (T/3600);
m = (T - (3600 * h)) / 60;
s = (T - (3600 * h) - (60 * m));
snprintf(time_str, 10, "%02i:%02i:%02i\n", h, m, s);
return time_str;
}
int main() {
char *answer = solution(7050);
printf("%s", answer);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment