bacco

Самолет; Airplane

Feb 6th, 2018
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.88 KB | None | 0 0
  1. using System;
  2.  
  3. namespace tESt
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             var hours = int.Parse(Console.ReadLine());
  10.             var minutes = int.Parse(Console.ReadLine());
  11.             var flightTime = int.Parse(Console.ReadLine());
  12.  
  13.             var hoursToMinutes = hours * 60;
  14.             var totalMinutes = hoursToMinutes + minutes;
  15.  
  16.             var timeOfLanding = totalMinutes + flightTime;
  17.  
  18.             var landingHours = timeOfLanding / 60;
  19.             var landingMinutes = timeOfLanding % 60;
  20.  
  21.             if (landingHours > 24)
  22.             {
  23.              landingHours =  landingHours % 24;
  24.  
  25.             Console.WriteLine($"{landingHours}h {landingMinutes}m");
  26.             }
  27.             else
  28.             {
  29.                 Console.WriteLine($"{landingHours}h {landingMinutes}m");
  30.             }
  31.         }
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment