Advertisement
Spocoman

03. Time + 15 Minutes

Aug 24th, 2024
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.47 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 minute = Integer.parseInt(scanner.nextLine());
  8.  
  9.         int totalMinutes = hour * 60 + minute + 15;
  10.         int hours = totalMinutes / 60 % 24;
  11.         int minutes = totalMinutes % 60;
  12.  
  13.         System.out.printf("%d:%02d", hours, minutes);
  14.     }
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement