Advertisement
Guest User

Untitled

a guest
Jul 4th, 2017
351
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.64 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3.  
  4. class Program
  5. {
  6.     static void Main()
  7.     {
  8.         var timeLeaving = Console.ReadLine().Split(':').Select(int.Parse).ToArray();
  9.         long seconds = timeLeaving[2] + 60 * timeLeaving[1] + 60 * 60 * timeLeaving[0];
  10.         var secondsToAdd =
  11.             long.Parse(Console.ReadLine()) *
  12.             long.Parse(Console.ReadLine());
  13.         seconds = seconds + secondsToAdd;
  14.  
  15.         var secs = seconds % 60;
  16.         var mins = (seconds / 60) % 60;
  17.         var hours = (seconds / 60 / 60) % 24;
  18.  
  19.         Console.WriteLine("Time Arrival: {0:d2}:{1:d2}:{2:d2}",
  20.             hours, mins, secs);
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement