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