Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.74 KB | None | 0 0
  1. package com.company;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Main {
  6.  
  7.     public static void main(String[] args) {
  8.         Scanner scanner = new Scanner(System.in);
  9.  
  10.         int h = Integer.parseInt(scanner.nextLine());
  11.         int m = Integer.parseInt(scanner.nextLine());
  12.  
  13.         int totalM = m + 15;
  14.         int totalH = h;
  15.         if (totalM >= 60){
  16.             totalH = totalH + 1;
  17.             totalM = totalM % 60;
  18.         }
  19.         String minFormat = "";
  20.         if (totalM < 10){
  21.             minFormat = "0" + totalM;
  22.         } else {
  23.             minFormat = ""+totalM;
  24.         }
  25.  
  26.         if (totalH >= 24){
  27.             totalH = totalH - 24;
  28.         }
  29.  
  30.         System.out.printf("%d:%s", totalH,minFormat);
  31.  
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement