grach

TimePlus15Min

Jul 11th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.96 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 TimePlus15Mins
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.  
  14.             var H = int.Parse(Console.ReadLine());
  15.             var M = int.Parse(Console.ReadLine());
  16.  
  17.             var min = M + 15;
  18.  
  19.             if (min > 59)
  20.             {
  21.                 H = H + 1;
  22.                 min = min - 60;
  23.             }
  24.  
  25.             if (H >= 24)
  26.             {
  27.                 H = H - 24;
  28.             }
  29.            
  30.             Console.WriteLine("{0}:{01:00}", H, min);
  31.            
  32.         }
  33.     }
  34. }
  35.  
  36. // var sec1 = int.Parse(Console.ReadLine());
  37. // var sec2 = int.Parse(Console.ReadLine());
  38.  
  39. // var sec3 = int.Parse(Console.ReadLine());
  40. // var secs = sec1 + sec2 + sec3;
  41. // var mins = secs / 60;
  42. // secs = secs % 60;
  43. // Console.WriteLine("{0}:{1}", mins, secs.ToString().PadLeft(2, '0'));
Advertisement
Add Comment
Please, Sign In to add comment