VelizarAvramov

03. Back in 30 Minutes

Jul 17th, 2018
326
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.88 KB | None | 0 0
  1. Every time Stamat tries to pay his bills he sees on the cash desk the sign: "I will be back in 30 minutes". One day Stamat was sick of waiting and decided he needs a program, which prints the time after 30 minutes. That way he won’t have to wait on the desk and come at the appropriate time. He gave the assignment to you, so you have to do it.
  2. using System;
  3.  
  4. namespace _03._Back_in_30_Minutes
  5. {
  6.     class BackIn30Mins
  7.     {
  8.         static void Main(string[] args)
  9.         {
  10.             int hours = int.Parse(Console.ReadLine());
  11.             int mins = int.Parse(Console.ReadLine());
  12.  
  13.             mins += 30;
  14.  
  15.             if (mins > 59)
  16.             {
  17.                 hours++;
  18.                 mins -= 60;
  19.             }
  20.             if (hours > 23)
  21.             {
  22.                 hours = 0;
  23.             }
  24.             Console.WriteLine("{0}:{1:d2}", hours, mins);
  25.         }
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment