Skip to content

Instantly share code, notes, and snippets.

@btechmag
Created April 26, 2021 17:21
Show Gist options
  • Save btechmag/66fe5ebee818740cac9e37f71d1e9cc7 to your computer and use it in GitHub Desktop.
Save btechmag/66fe5ebee818740cac9e37f71d1e9cc7 to your computer and use it in GitHub Desktop.
C Program to convert an integer to hours, minutes and seconds.
#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