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