Algorithm


Problem Name: beecrowd | 1019

Time Conversion

Adapted by Neilor Tonin, URI Brazil

Timelimit: 1

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 Sample Output Sample

556

0:9:16

 

1

0:0:1

 

140153

38:55:53

 

Code Examples

#1 Code Example with C Programming

Code - C Programming



#include <stdio.h>
int main()
{
 int t;
 
scanf("%d", &t);

int h = t / 3600;
 t= t - ( h * 3600);

 int m = t / 60;
 t = t - ( m * 60);

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

return 0;
Copy The Code & Try With Live Editor

Input

x
+
cmd
556

Output

x
+
cmd
0:9:16

#2 Code Example with C++ Programming

Code - C++ Programming



#include <iostream>

using namespace std;

int main()
{
    int t;
    
    cin >> t;

    int h = t/ 3600;
    t = t - (h * 3600);

    int m = t/60;
    t = t - (m * 60);

    cont << h <<  ":" << m << ":" << t << endl;

    return 0;
}

Copy The Code & Try With Live Editor

Input

x
+
cmd
1

Output

x
+
cmd
0:0:1

#3 Code Example with Java Programming

Code - Java Programming



import java.util.Scanner;

public class Main {
   
  public static void main(String[] args) {
     int t;
     
     Scanner sc = new Scanner(System.in);
     t = sc.nextInt();

     int h = t / 3600;
     t= t - ( h * 3600);

     int m = t / 60;
     t = t - ( m * 60);

     System.out.printf("%d:%d:%d\n", h , m , t);
     }
}
Copy The Code & Try With Live Editor

Input

x
+
cmd
140153

Output

x
+
cmd
38:55:53
Advertisements

Demonstration


Previous
#1018 Beecrowd Online Judge Solution 1018 Banknotes Solution in C, C++, Java, Python and C#
Next
#1020 Beecrowd Online Judge Solution 1020 Age in Days Solution in C, C++, Java, Python and C#