Advertisement
Guest User

Untitled

a guest
May 26th, 2019
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class time15 {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6.  
  7. int hour = Integer.parseInt(scanner.nextLine());
  8. int min = Integer.parseInt(scanner.nextLine());
  9.  
  10. if (min>=46&& min<=54){
  11. hour += 1;
  12. min = (min+15)-60;
  13. if (hour==24){
  14. hour = 0;
  15. }
  16. System.out.printf("%d:0%d",hour,min);
  17. } else if (min<=44) {
  18. min = (min + 15);
  19. System.out.printf("%d:%d", hour, min);
  20. } else if (min==45) {
  21. hour += 1;
  22. min = (min + 15)-60;
  23. if (hour==24){
  24. hour = 0;
  25. }
  26. System.out.printf("%d:%d0", hour, min);
  27. } else if (min>=55){
  28. hour += 1;
  29. min = (min+15)-60;
  30. if (hour==24){
  31. hour = 0;
  32. }
  33. System.out.printf("%d:%d", hour, min);
  34. }
  35.  
  36.  
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement