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