URI Online Judge | 1019 Time Conversion (Solution)

Problem Link:
https://www.urionlinejudge.com.br/judge/en/problems/view/1019

URI Online Judge | 1019

Time Conversion

Adapted by Neilor Tonin, URI  Brazil
Timelimit: 1
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 InputSample Output
5560:9:16
10:0:1
14015338: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

Popular posts from this blog

URI Online Judge | 1036 Bhaskara's Formula (Solution)

URI Online Judge | 1043 Triangle (Solution)

URI Online Judge | 1042 Simple Sort (Solution)