Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package TestJan;
- import java.util.Scanner;
- public class Airplane {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int hour = Integer.parseInt(scanner.nextLine());
- int minutes = Integer.parseInt(scanner.nextLine());
- int flightLasting = Integer.parseInt(scanner.nextLine());
- int lastingTimeHourandMinutes = hour * 60 + minutes + flightLasting;
- int hourLasting = lastingTimeHourandMinutes / 60;
- int minutesLasting = lastingTimeHourandMinutes % 60;
- if (minutesLasting >= 60) {
- hour++;
- }
- if (hourLasting >= 23) {
- hourLasting = hourLasting - 24;
- }
- System.out.println(hourLasting + "h " + minutesLasting + "m");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement