Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace _1._4_Back_in_30_Minutes
- {
- class Program
- {
- static void Main(string[] args)
- {
- // Input --> Sirst line: hours ( 0 - 23 ) - Second line: minutes ( 0 - 59 )
- //Output --> format hh:mm. The hours have one or two numbers and the minutes have always two numbers (with leading zero).
- int hours = int.Parse(Console.ReadLine());
- int minutes = int.Parse(Console.ReadLine());
- minutes += 30;
- if (minutes > 59)
- {
- hours += 1;
- minutes -= 60;
- }
- if ( hours > 23 )
- {
- hours = 0;
- }
- Console.WriteLine($"{hours}:{minutes:D2}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment