SHARE
TWEET

Time + 15 minutes

a guest Feb 15th, 2020 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2.  
  3.  
  4.     class Program
  5.     {
  6.     static void Main(string[] args)
  7.     {
  8.  
  9.         double hour = double.Parse(Console.ReadLine());
  10.         double minutes = double.Parse(Console.ReadLine());
  11.  
  12.         double finalHour = 0;
  13.         double finalMinutes = 0;
  14.  
  15.         if (minutes <= 44)
  16.         {
  17.             finalHour = hour;
  18.             finalMinutes = minutes + 15;
  19.            
  20.         }
  21.  
  22.         if (hour >= 24)
  23.         {
  24.             finalHour -= 24;
  25.            
  26.  
  27.         }
  28.  
  29.  
  30.         else if (minutes >= 45)
  31.         {
  32.             finalHour = hour + 1;
  33.             finalMinutes = minutes - 45;
  34.            
  35.         }
  36.  
  37.         Console.WriteLine($"{finalHour}:{finalMinutes:D2}");
  38.         //ако оставя ":D2" ми дава "unhandled exception", ако махна ":D2" ми излиза резултат 2:1, но идеята е релултатът да е 2:01.
  39.  
  40.     }
  41. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top