Created
April 26, 2021 17:21
-
-
Save btechmag/66fe5ebee818740cac9e37f71d1e9cc7 to your computer and use it in GitHub Desktop.
C Program to convert an integer 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() | |
{ | |
//Program to convert integer to hours, minutes and seconds | |
int hrs, min, sec; | |
printf("Input seconds: "); | |
scanf("%d", &sec); | |
hrs = sec / 3600; | |
min = (sec % 3600) / 60; | |
sec = (sec % 3600) % 60; | |
printf("Hours = %d\nMinutes = %d\nSeconds = %d", hrs, min, sec); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment