Advertisement
martinvalchev

Time+15 Minutes

Oct 23rd, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.61 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class TimePLUS15Minutes {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.         int hour = Integer.parseInt(scanner.nextLine());
  7.         int min = Integer.parseInt(scanner.nextLine());
  8.  
  9.         min += 15;
  10.  
  11.         if (min >= 60) {
  12.             hour +=1;
  13.             min -= 60;
  14.         }
  15.         if (hour >= 24) {
  16.             hour -= 24;
  17.         }
  18.         if (min < 10) {
  19.             System.out.println(hour + ":0" + min);
  20.         }
  21.         else {
  22.             System.out.println(hour + ":" + min);
  23.         }
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement