Didart

Back In 30 Minutes

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