Advertisement
VlaDun

Untitled

Sep 20th, 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 scan = new Scanner(System.in);
  9.         int hour = Integer.parseInt(scan.nextLine());
  10.         int minutes = Integer.parseInt(scan.nextLine());
  11.  
  12.         if (minutes < 60) {
  13.             minutes = minutes + 15;
  14.             int mins = minutes % 60;
  15.  
  16.             if (minutes >= 60) {
  17.                 hour = hour + 1;
  18.             }
  19.             if (hour > 23) {
  20.                 hour = 0;
  21.             }
  22.  
  23.             if (mins <= 9) {
  24.                 System.out.printf("%d:0%d", hour, mins);
  25.             } else {
  26.                 System.out.printf("%d:%d", hour, mins);
  27.             }
  28.         }
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement