“Sometimes it is the people no one can imagine anything of who do the things no one can imagine.” ― Sir Alan Turing


ADS

ADS

Tuesday, March 28, 2017

URI 1019 - Time Conversion || Solution in C / C++



Read an integer value, which is the duration in seconds of a certain event in a factory, and inform it 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.
Input SampleOutput Sample
5560:9:16
10:0:1
14015338:55:53

SOURCE CODE

#include <stdio.h>

int main()

{
  int t, h, m, s;

  scanf("%d", & t);

  h = t / 3600;

  m = (t % 3600) / 60;

  s = (t % 60);

  printf("%d:%d:%d\n", h, m, s);

  return 0;
}

No comments:

Post a Comment