C program to coverts seconds in hh:mm:ss format

C program to coverts seconds in hh:mm:ss format

Write a C program to coverts seconds in hh:mm:ss format.


#include 
int main() {
int sec, h, m, s;
printf("Input seconds: ");
scanf("%d", &sec);
h = (sec/3600);
m = (sec -(3600*h))/60;
s = (sec -(3600*h)-(m*60));
printf("HH:MM:SS - %d:%d:%d\n",h,m,s);
return 0;
}