Advertisement
Guest User

Untitled

a guest
Jan 20th, 2017
402
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.52 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3.  
  4. public class Program
  5. {
  6.     public static void Main()
  7.     {
  8.         string input = Console.ReadLine();
  9.         string[] split = input.Split(':');
  10.  
  11.         ulong hour = ulong.Parse(split[0]);
  12.         ulong minites = ulong.Parse(split[1]);
  13.         ulong secounds = ulong.Parse(split[2]);
  14.  
  15.         ulong numberSteps = ulong.Parse(Console.ReadLine());
  16.         ulong stepSeconds = ulong.Parse(Console.ReadLine());
  17.  
  18.       ulong total = numberSteps * stepSeconds + (hour * 60 * 60) + (minites * 60) + secounds;
  19.  
  20.         ulong  hour1 = total / 60 / 60;
  21.         ulong  hour2 = (total - hour1 * 3600) / 60;
  22.         ulong  hour3 = (total - hour1 * 3600) % 60;
  23.  
  24.         string printsHours = "" + hour1;
  25.         string printsMinutes = "" + hour2;
  26.         string printsSecounds = "" + hour3;
  27.  
  28.         if (hour1 > 24)
  29.         {
  30.             hour1 = hour1 % 24;
  31.         }
  32.         if (hour2 > 60)
  33.         {
  34.             hour1 = hour1 % 60;
  35.         }
  36.         if (hour1 < 10)
  37.         {
  38.             printsHours = "" + 0 + hour1;
  39.         }
  40.         if (hour2 < 10)
  41.         {
  42.             printsMinutes = "" + 0 + hour2;
  43.         }
  44.         if (hour3 < 10)
  45.         {
  46.             printsSecounds = "" + 0 + hour3;
  47.         }
  48.  
  49.  
  50.         /*Console.WriteLine(total);
  51.         Console.WriteLine(printsHours);
  52.         Console.WriteLine(printsMinutes);
  53.         Console.WriteLine(printsSecounds);*/
  54.  
  55.         Console.WriteLine("Time Arrival: " + printsHours + ":" + printsMinutes + ":" + printsSecounds);
  56.     }
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement