Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _5.TimeAfter15Minutes
- {
- class Program
- {
- static void Main(string[] args)
- {
- //1. прочитаме час и минути
- //2. преобразуваме текущото време в минути
- //3. добавяме към текущото време 15 минути
- //4. преобразуваме крайно време в часове и минути
- //часове = крайно време / 60
- //секунди = крайно време % 60
- //5. печатаме във формат: часове:минути
- int currentHour = int.Parse(Console.ReadLine());
- int currentMinutes = int.Parse(Console.ReadLine());
- int currentTimeInMinutes = currentHour * 60 + currentMinutes;
- int finalTimeInMinutes = currentTimeInMinutes + 15;
- int finalHour = finalTimeInMinutes / 60;
- int finalMinutes = finalTimeInMinutes % 60;
- if (finalHour == 24)
- {
- finalHour = 0;
- }
- Console.WriteLine($"{finalHour}:{finalMinutes:D2}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement