URI Online Judge Solution 1019 Time Conversion – URI 1019 Solution in C, C++, Java, Python and C#

URI Online Judge Solution URI Solution -Beginner

URI Online Judge Solution 1019 Time Conversion – URI 1019 Solution in C, C++, Java, Python and C#

URI Online Judge Solution 1019 Time Conversion  | Beginner
URI Problem Link – https://www.urionlinejudge.com.br/judge/en/problems/view/1019

Problem Name: 1019 Time Conversion code
Problem Number : URI – 1019 Time Conversion solution
Online Judge : URI Online Judge Solution
Category: Beginner
Solution Language : C,C plus plus, java, python, c#(c sharp)

URI Online Judge Solution 1019 Time Conversion - URI 1019 Solution in C, C++, Java, Python and C#

URI Solution 1019 Time Conversion  Code in C / URI 1019 solution in C:

#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:%dn", h, m, t);

return
0;
}

URI Solution 1019 Time Conversion  Code / URI 1019 solution in CPP:

#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);

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

return
0;
}

URI Solution 1019 Time Conversion  Code / URI 1019 solution in Java:

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:%dn", h, m, t);

}

}

URI Solution 1019 Time Conversion  Code / URI 1019 solution in  Python:

URI Solution 1019 Time Conversion  Code / URI 1019 solution in  C# (C Sharp):

Demonstration:

It’s a simple time conversion problem of URI online judge.
Look the screenshot and see the time is in seconds. We need to convert it to hour, minute and second.

To convert hour divide it by 3600 [1 hour = 3600 seconds]

int h = t / 3600;

Then,  subtract the hour * 3600 from given time and get reminder time

t = t - (h * 3600);

Then, the time is now in seconds and to find minute, just divide it by 60

int m = t / 60;

And the rest of the work is same..Just do that code. Happy coding…
Just implement this in coding. Since having any problem just put a comment below. Thanks

Tags: URI Online Judge Solution, URI OJ Solution list, URI Problems Solution, URI solver, URI all problem solution list, URI Time Conversion code in C, URI 1019 code in C++, URI Time Conversion solution in C, URI solution, URI 1019 solution in C,URI 1019 solution in C++-CPP,URI 1019 solution in C# (C sharp),URI 1019 solution in Java,URI 1019 solution in Python,

Leave a Reply

Your email address will not be published.