Convert time given in seconds to hours, minutes and seconds
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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