Advertisement
tissiana

TimePlus15

May 2nd, 2018
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.76 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 Time_15Minutes
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int hour = int.Parse(Console.ReadLine());
  14.             int minutes = int.Parse(Console.ReadLine());
  15.             int hourInMInutes = hour * 60;
  16.  
  17.             int totalMinutes = hourInMInutes + minutes;
  18.             int minutesPlus15 = totalMinutes + 15;
  19.  
  20.             int newHour = minutesPlus15 / 60;
  21.             int newMinutes = minutesPlus15 % 60;
  22.             if(newHour == 24)
  23.             {
  24.                 newHour = 0;
  25.             }
  26.  
  27.             Console.WriteLine("{0}:{1:00}",newHour,newMinutes);
  28.         }
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement