Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Airplane1 {
- public static void main(String[] agrs) {
- Scanner scanner = new Scanner(System.in);
- int hours = Integer.parseInt(scanner.nextLine());
- int minutes = Integer.parseInt(scanner.nextLine());
- int fly = Integer.parseInt(scanner.nextLine());
- int TotalMinutes = hours * 60 + minutes;
- int Arrive = fly + TotalMinutes;
- int FlyMinutes = Arrive % 60;
- int FlyHours = Arrive / 60;
- if (FlyHours >= 23) {
- FlyHours = FlyHours - 24;
- }
- if (FlyMinutes >= 60) {
- FlyHours++;
- }
- System.out.printf("%dh %dm", FlyHours, FlyMinutes);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement