MladenKarachanov

Time15Minutes

Jul 13th, 2023
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.63 KB | None | 0 0
  1. package firstStepsInCoding.MoreExercises;
  2.  
  3.  
  4.  
  5. import java.util.Scanner;
  6.  
  7.         public class Time15Minutes {
  8.             public static void main(String[] args) {
  9.                 Scanner scanner= new Scanner(System.in);
  10.                 int hours=Integer.parseInt(scanner.nextLine());
  11.                 int minutes=Integer.parseInt(scanner.nextLine());
  12.                 int totaltime=hours*60+minutes+15;
  13.                 hours=totaltime/60;
  14.                 minutes=totaltime%60;
  15.                 if (hours>23){
  16.                     hours=0;}
  17.  
  18.                 System.out.printf("%d:%02d",hours,minutes);
  19.  
  20.  
  21.             }
  22.         }
  23.  
  24.  
  25.  
  26.  
Add Comment
Please, Sign In to add comment