Advertisement
veronikaaa86

04. Back In 30 Minutes

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