Advertisement
veronikaaa86

03. Time + 15 Minutes

Jan 16th, 2022
433
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. package conditionalStatements;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class P03TimePlus15Minutes {
  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 allMin = (initHour * 60) + initMin + 15;
  13.  
  14. int hour = allMin / 60;
  15. int min = allMin % 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