Advertisement
kallyy7

Untitled

Feb 27th, 2018
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.82 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApp3
  8. {
  9.     class Program
  10.     {
  11.         static void Main()
  12.         {
  13.             int hour = int.Parse(Console.ReadLine());
  14.             int min = int.Parse(Console.ReadLine());
  15.             int flightDuration = int.Parse(Console.ReadLine());
  16.  
  17.             int extraHours = min + flightDuration;
  18.             int durationHours = extraHours / 60;
  19.             int extraMinutes = extraHours % 60;
  20.  
  21.             int arrivalHour = durationHours + hour;
  22.             int arrivalMin = extraMinutes;
  23.             if (arrivalHour >= 24)
  24.             {
  25.                 arrivalHour = arrivalHour - 24;
  26.             }
  27.             Console.WriteLine($"{arrivalHour}h {arrivalMin}m");
  28.         }
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement