Advertisement
damesova

Time + 15 min / Java

Nov 16th, 2018
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. package ConditionalStatementsExcercises;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class TimeAnd15Min {
  6. public static void main(String[] args) {
  7. Scanner scanner = new Scanner(System.in);
  8.  
  9. int h = Integer.parseInt(scanner.nextLine());
  10. int m = Integer.parseInt(scanner.nextLine());
  11.  
  12. int mm = m + 15;
  13.  
  14. if (mm > 59) {
  15. mm = mm % 60;
  16. h = h + 1;
  17. }
  18.  
  19. if (h > 23) {
  20. h = h -24;
  21. }
  22.  
  23. System.out.printf("%d:%02d", h, mm);
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement