Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class P04BackIn30Minutes {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int initHours = Integer.parseInt(scanner.nextLine());
- int initMinutes = Integer.parseInt(scanner.nextLine());
- //1:46 + 30 -> 1*60 = 60 + 46 + 30 = 136 -> 2:16
- int allMinutes = (initHours * 60) + initMinutes + 30;
- int hours = allMinutes / 60;
- int minutes = allMinutes % 60;
- if (hours > 23) {
- hours = 0;
- }
- System.out.printf("%d:%02d", hours, minutes);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement