Advertisement
tsvetelinapasheva

TsvetelinaPasheva/ConditionalStatementsExercise/05.Time+15 Minutes

Jan 19th, 2021
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.72 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ConsoleApp12
  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.  
  12.             minutes += 15;
  13.  
  14.             if (minutes >= 60)
  15.             {
  16.                 hour += 1;
  17.                 minutes -= 60;
  18.             }
  19.  
  20.             if (hour == 24)
  21.             {
  22.                 hour = 0;
  23.             }
  24.  
  25.             if (minutes < 10)
  26.             {
  27.                 Console.WriteLine($"{hour}:{minutes:d2}");
  28.             }
  29.             else
  30.             {
  31.                 Console.WriteLine($"{hour}:{minutes}");
  32.             }
  33.  
  34.            
  35.         }
  36.     }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement