VelizarAvramov

03. Back in 30 Minutes

Nov 6th, 2019
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.53 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _03._Back_in_30_Minutes
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int hour = int.Parse(Console.ReadLine());
  10.             int mins = int.Parse(Console.ReadLine());
  11.  
  12.             mins += 30;
  13.  
  14.             if (mins > 59)
  15.             {
  16.                 hour++;
  17.                 mins -= 60;
  18.             }
  19.             if (hour > 23)
  20.             {
  21.                 hour = 0;
  22.             }
  23.  
  24.             Console.WriteLine($"{hour}:{mins:d2}");
  25.         }
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment