tchenkov

L03u14_TimePlusMinutes

Jan 18th, 2017
370
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.59 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. /*
  4.  * Created by todor on 18.01.2017 г..
  5.  */
  6. public class u14_TimePlusMinutes {
  7.     public static void main(String[] args) {
  8.  
  9.         Scanner scan = new Scanner(System.in);
  10.  
  11.         int hours = Integer.parseInt(scan.nextLine());
  12.         int minutes = Integer.parseInt(scan.nextLine());
  13.  
  14.         int timePlusMinutes = (hours * 60) + minutes + 15;
  15.  
  16.         hours = timePlusMinutes / 60;
  17.  
  18.         if (hours>=24){
  19.             hours = hours % 24;
  20.         }
  21.         minutes = timePlusMinutes % 60;
  22.  
  23.         System.out.printf("%d:%02d", hours, minutes);
  24.     }
  25. }
Add Comment
Please, Sign In to add comment