Advertisement
Grimmjow1

timePlus15

Jan 26th, 2019
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.86 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace TimePlus15
  7. {
  8.     class Program
  9.     {
  10.         static void Main(string[] args)
  11.         {
  12.             int startHour = int.Parse(Console.ReadLine());
  13.             int startMinutes = int.Parse(Console.ReadLine());
  14.  
  15.             int allInMinutes = startHour * 60 + startMinutes;
  16.             int timePlus = allInMinutes + 15;
  17.  
  18.             int finalHour = timePlus / 60;  
  19.             int finalMintes = timePlus%60;
  20.             if (finalHour==24)
  21.             {
  22.                 finalHour = 0;
  23.             }
  24.             if (finalMintes<10)
  25.             {
  26.                 Console.WriteLine(finalHour+":"+"0"+finalMintes);
  27.             }
  28.             else
  29.             {
  30.                 Console.WriteLine(finalHour+":"+finalMintes);
  31.             }
  32.         }  
  33.     }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement