Advertisement
dakata

Plus 15 minutes

Oct 10th, 2016
620
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.55 KB | None | 0 0
  1. using System;
  2.  
  3. namespace TimePlus15
  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.  
  12.             if (minutes + 15 > 59)
  13.             {
  14.                 hours += 1;
  15.                 minutes = 15 - (60 - minutes);
  16.             }
  17.             else if(minutes + 15 <= 59) minutes += 15;
  18.  
  19.             if (hours == 24) hours = 0;
  20.  
  21.             Console.WriteLine("{0}:{1:00}", hours, minutes);
  22.         }
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement