Challenge: Seconds to Time

Lab C Beginner 10 points

Read a number of seconds and print it as hours, minutes and seconds.

Input

One integer: the number of seconds.

Output

H hours, M minutes, S seconds

Example

Input

3725

Output

1 hours, 2 minutes, 5 seconds
Sample input available Sample output available
Editor
C

Hints

An hour has 3600 seconds.

Use % to find what is left over after the full hours.

Solution explanation

/ counts the full hours; % keeps the rest, which we split into minutes and seconds the same way.

Show solution
#include <stdio.h>

int main() {
    int total;
    scanf("%d", &total);
    int hours = total / 3600;
    int minutes = (total % 3600) / 60;
    int seconds = total % 60;
    printf("%d hours, %d minutes, %d seconds\n", hours, minutes, seconds);
    return 0;
}
Output
Answer
HOME LABS COMMUNITY DASHBOARD