Advertisement
MARINA_GREBENAROVA

TimeAnd15Minutes

Oct 3rd, 2021
1,005
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.79 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 hour = int.Parse(Console.ReadLine());
  10.             int minutes = int.Parse(Console.ReadLine());
  11.             int timeMinutes = (hour * 60) + minutes;
  12.             int minuts15 = timeMinutes + 15;
  13.             int totalHours = minuts15 / 60;
  14.             int totalMinutes = minuts15 % 60;
  15.  
  16.             if (totalHours >= 24)
  17.             {
  18.                 totalHours -= 24;
  19.             }
  20.             if (totalMinutes < 10)
  21.             {
  22.                 Console.WriteLine($"{totalHours}:0{totalMinutes}");
  23.             }
  24.             else
  25.             {
  26.                 Console.WriteLine($"{totalHours}:{totalMinutes}");
  27.             }
  28.         }
  29.     }
  30. }
  31.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement