Skip to content

Instantly share code, notes, and snippets.

@faisal95bd
Last active April 13, 2022 07:20
Embed
What would you like to do?
Convert time given in seconds to hours, minutes and seconds
#include<stdio.h>
int main() {
int sec, hh, mm, ss;
printf("Enter time in seconds: ");
scanf("%d", & sec);
hh = sec / 3600;
mm = (sec - hh * 3600) / 60;
ss = sec - hh * 3600 - mm * 60;
printf("%d seconds = %d hour %d minute %d second", sec, hh, mm, ss);
return (0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment