Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.company;
- import java.time.LocalDate;
- import java.time.format.DateTimeFormatter;
- import java.util.Scanner;
- public class SummingSeconds {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int p1 = Integer.parseInt(scanner.nextLine());
- int p2 = Integer.parseInt(scanner.nextLine());
- int p3 = Integer.parseInt(scanner.nextLine());
- int result = p1 + p2 + p3;
- if (result <60) {
- if (result<10) {
- System.out.println("0:0" + result);
- } else {
- System.out.println("0:" + result);
- }
- } else if (result >=60 && result<120) {
- if (result-60<10) {
- System.out.println("1:0" + (result-60));
- } else {
- System.out.println("1:" + (result - 60));
- }
- } else if (result>=120 && result < 180) {
- if (result-120<10) {
- System.out.println("2:0" + (result-120));
- } else {
- System.out.println("2:" + (result - 120));
- }
- }
- //code ends here
- }
- }
Add Comment
Please, Sign In to add comment