Wednesday, December 2, 2015

Uri problem 1019 solve

Problem :

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 input , hour , minutes , seconds;
    scanf("%d",&input);
    hour=(input/3600);
    minutes=(input-(hour*3600))/60;
    seconds= input-((hour*3600)+(minutes*60));
    printf("%d:%d:%d\n",hour,minutes,seconds);
  
    return 0;
}

No comments:

Post a Comment