Advertisement
Spocoman

04. Time After 30 Minutes

Oct 15th, 2024
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.49 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. class TimeAfter30Minutes {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.         int hours = Integer.parseInt(scanner.nextLine()),
  7.             minutes = Integer.parseInt(scanner.nextLine()),
  8.             totalMinutes = hours * 60 + minutes + 30,
  9.             hourTotal = totalMinutes / 60 % 24,
  10.             minuteTotal = totalMinutes % 60;
  11.        
  12.         System.out.printf("%d:%02d", hourTotal, minuteTotal);
  13.     }
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement