Advertisement
Guest User

Untitled

a guest
May 22nd, 2019
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class task4_2 {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6. int hours = Integer.parseInt(scanner.nextLine());
  7. int minutes = Integer.parseInt(scanner.nextLine());
  8.  
  9. minutes = minutes +30;
  10.  
  11. if (minutes > 59){
  12. hours = hours+1;
  13. minutes= minutes-60;
  14.  
  15.  
  16. }if (hours >23){
  17. hours = 0;
  18.  
  19. }if (minutes <10){
  20. System.out.printf("%d:0%d", hours, minutes);
  21.  
  22.  
  23. }else System.out.printf("%d:%d", hours,minutes);
  24.  
  25.  
  26.  
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement