nvnnaidenov

TimePlusFifteenMinutes - Chapter 3.0

Feb 10th, 2022
1,271
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.53 KB | None | 0 0
  1. //Task 014, Chapter 3.0
  2. using System;
  3.  
  4. public class TimePlusFifteenMinutes
  5. {
  6.     static void Main()
  7.     {
  8.         int hours = int.Parse(Console.ReadLine());
  9.         int minutes = int.Parse(Console.ReadLine());
  10.  
  11.         if(minutes + 15 >= 60)
  12.         {
  13.             hours++;
  14.             minutes = minutes + 15 - 60;
  15.         }
  16.         else
  17.         {
  18.             minutes += 15;
  19.         }
  20.  
  21.         if(hours >= 24)
  22.         {
  23.             hours -= 24;
  24.         }
  25.  
  26.         Console.WriteLine($"{hours:D1}:{minutes:D2}");
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment