IvetValcheva

03. Time + 15 Minutes

Jan 17th, 2022
312
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.67 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 h = int.Parse(Console.ReadLine());
  10.             int m = int.Parse(Console.ReadLine());
  11.  
  12.             int timeInMin = m + h * 60;
  13.             timeInMin = timeInMin + 15;
  14.  
  15.             h = timeInMin / 60;
  16.             m = timeInMin % 60;
  17.  
  18.             if (h == 24)
  19.             {
  20.                 h = 0;
  21.             }
  22.  
  23.             if (m < 10)
  24.             {
  25.                 Console.WriteLine($"{h}:0{m}");
  26.             }
  27.             else
  28.             {
  29.                 Console.WriteLine($"{h}:{m}");
  30.             }
  31.         }
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment