Advertisement
fbinnzhivko

Untitled

Sep 12th, 2016
502
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.53 KB | None | 0 0
  1. using System;
  2. class Program
  3. {
  4.     static void Main()
  5.     {
  6.         int h = int.Parse(Console.ReadLine());
  7.         int m = int.Parse(Console.ReadLine());
  8.         m = m + 15;
  9.  
  10.         if (m < 10)
  11.         {
  12.             Console.WriteLine(h + ":0" + m);
  13.         }
  14.         else if (m >= 60)
  15.         {
  16.             h = h + 1;
  17.             m = m - 60;
  18.             if (h > 24 && m >= 1 && m <= 9)
  19.             {
  20.                 h = h - 24;
  21.                 Console.WriteLine("{0}:0{1}", h, m);
  22.             }
  23.             else if (h >= 24 && m >= 10)
  24.             {
  25.                 h = h - 24;
  26.                 Console.WriteLine("{0}:{1}", h, m);
  27.             }
  28.             else if (h == 24 && m == 0)
  29.             {
  30.                 Console.WriteLine("0:00");
  31.             }
  32.             else if(h == 24 && m >= 1 && m <= 9)
  33.             {
  34.  
  35.                 Console.WriteLine("0:0{0}",m);
  36.             }
  37.             else if (h == 24 && m >= 10)
  38.             {
  39.  
  40.                 Console.WriteLine("0:{0}", m);
  41.             }
  42.             else
  43.             {
  44.                 if (m >= 0 && m <= 9)
  45.                 {
  46.                     Console.WriteLine(h + ":0" + m);
  47.                 }
  48.                 else
  49.                 {
  50.                     Console.WriteLine(h + ":" + m);
  51.                 }
  52.             }
  53.  
  54.         }
  55.         else if (h > 23)
  56.         {
  57.             h = h % 24;
  58.             Console.WriteLine("{0}:{01:00}", h, m);
  59.         }
  60.         else
  61.         {
  62.             Console.WriteLine("{0}:{1}", h, m);
  63.         }
  64.  
  65.     }
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement