Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class P14_HoursAndMins {
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- int hours = Integer.parseInt(sc.nextLine());
- int mins = Integer.parseInt(sc.nextLine());
- int total = hours * 60 + mins + 15;
- int leftHours = total / 60;
- int leftMins = total % 60;
- if (leftHours == 24) {
- leftHours = 0;
- }
- if (leftMins <= 9){
- System.out.printf("%d:0%d",leftHours,leftMins);
- } else {
- System.out.printf("%d:%d",leftHours,leftMins);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement