Input The Time In Seconds And Convert It To Hours And Minutes

Input The Time In Seconds And Convert It To Hours And Minutes

Code
// Input the time in seconds and convert it to hours and minutes.

#include <stdio.h>
int main()
{
    int sec, hr, min;
    printf("Enter The Second: ");
    scanf("%d", &sec);
    hr = sec / 3600;
    min = (sec % 3600) / 60;
    printf("%dHour %dMin", hr, min);
    return 0;
}
Output
Enter The Second: 10000
2Hour 46Min

Post a Comment