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