Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package BasicSyntax_Lab;
- import java.util.Scanner;
- public class BackIn30Minutes_04 {
- 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 totalTimeInMinutes = hours * 60 + minutes;
- int timeAfter30Minutes = totalTimeInMinutes + 30;
- int finalHour = timeAfter30Minutes / 60;
- int finalMinutes = timeAfter30Minutes % 60;
- if(finalHour >= 24) {
- finalHour = 0;
- }
- System.out.printf("%d:%02d", finalHour, finalMinutes);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment