Advertisement
Guest User

Untitled

a guest
Feb 19th, 2020
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.64 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Time_15_Minutes
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int hours = int.Parse(Console.ReadLine());
  10.             int minutes = int.Parse(Console.ReadLine());
  11.  
  12.             int hoursInMinutes = hours*60;
  13.             int minutesPlus15 = hoursInMinutes + minutes + 15;
  14.  
  15.             int hoursAfter15 = minutesPlus15 / 60;
  16.             int minutesAfter15 = minutesPlus15 % 60;
  17.  
  18.             if (hoursAfter15 == 24)
  19.             {
  20.                 hoursAfter15 = 0;
  21.             }
  22.  
  23.             Console.WriteLine($"{hoursAfter15}:{minutesAfter15:D2}");
  24.         }
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement