URI Online Judge | 1019
Conversão de Tempo
Adaptado por Neilor Tonin, URI
Brasil
Timelimit: 1
Brasil
Leia um valor inteiro, que é o tempo de duração em segundos de um determinado evento em uma fábrica, e informe-o expresso no formato horas:minutos:segundos.
Entrada
O arquivo de entrada contém um valor inteiro N.
Saída
Imprima o tempo lido no arquivo de entrada (segundos), convertido para horas:minutos:segundos, conforme exemplo fornecido.
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 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.
#include <stdio.h>
int main() {
int T, H, H_S, M, S;
H_S=3600;
scanf("%d", &T);
H=(T/H_S);
M=(T -(H_S*H))/60;
S= (T-(H_S*H)-(M*60));
printf("%d:%d:%d\n",H,M,S);
return 0;
}
Nenhum comentário:
Postar um comentário