URI Online Judge | 1019 Time Conversion (Solution)
Problem Link:
https://www.urionlinejudge.com.br/judge/en/problems/view/1019
https://www.urionlinejudge.com.br/judge/en/problems/view/1019
URI Online Judge | 1019
Time Conversion
Adapted by Neilor Tonin, URI
Brazil
Timelimit: 1
Brazil
Read an integer value, which is the duration in seconds of a given event in a factory and tell print it in the format expressed in hours:minutes:seconds.
Input
The input file contains an integer N.
Output
Print the read time in the input file (seconds) converted in hours:minutes:seconds like the following example.
| Sample Input | Sample Output |
| 556 | 0:9:16 |
| 1 | 0:0:1 |
| 140153 | 38:55:53 |
Solution:
#include <stdio.h>int main(){ int n,h,m,s; scanf("%d",&n); h=n/(60*60); m=(n%(60*60))/60; s=(n%(60*60))%60; printf("%d:%d:%d\n",h,m,s);
Comments
Post a Comment