Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2018
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class P14_HoursAndMins {
  4. public static void main(String[] args) {
  5. Scanner sc = new Scanner(System.in);
  6.  
  7. int hours = Integer.parseInt(sc.nextLine());
  8. int mins = Integer.parseInt(sc.nextLine());
  9.  
  10. int total = hours * 60 + mins + 15;
  11.  
  12. int leftHours = total / 60;
  13. int leftMins = total % 60;
  14.  
  15. if (leftHours == 24) {
  16. leftHours = 0;
  17. }
  18.  
  19. if (leftMins <= 9){
  20. System.out.printf("%d:0%d",leftHours,leftMins);
  21. } else {
  22. System.out.printf("%d:%d",leftHours,leftMins);
  23. }
  24. }
  25.  
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement