Advertisement
braveheart1989

Time + 15 Minutes

Mar 4th, 2016
2,218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.86 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. using System.Globalization;
  7.  
  8. class Program
  9. {
  10.     static void Main(string[] args)
  11.     {
  12.         int hours = int.Parse(Console.ReadLine());
  13.         int minutes = int.Parse(Console.ReadLine());
  14.         int minutesAfterMinutes = minutes + 15;
  15.  
  16.         if (hours>=0 && hours<=23 && minutesAfterMinutes >= 60)
  17.         {
  18.             hours++;
  19.             if (hours == 24)
  20.             {
  21.                 hours = 0;
  22.             }
  23.             minutes = (minutesAfterMinutes) % 60;
  24.             Console.WriteLine("{0}:{1}", hours, minutes.ToString().PadLeft(2,'0'));
  25.         }
  26.         else
  27.         {
  28.             minutes = (minutesAfterMinutes) % 60;
  29.             Console.WriteLine("{0}:{1}", hours, minutes.ToString().PadLeft(2, '0'));
  30.         }
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement