IvetValcheva

08. Lunch Break

Nov 7th, 2021
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.09 KB | None | 0 0
  1. using System;
  2.  
  3. namespace demo
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             string seriesName = Console.ReadLine();
  10.             int seriesTime = int.Parse(Console.ReadLine());
  11.             int lunchBreakTime = int.Parse(Console.ReadLine());
  12.  
  13.             double lunchTime = lunchBreakTime / 8.0; // 1/8 ot lunchBreakTime
  14.             double breakTime = lunchBreakTime / 4.0; //2/8 ot lunchBreakTime
  15.            
  16.             double timeForSeries = lunchBreakTime - (lunchTime + breakTime);
  17.  
  18.             double difference = timeForSeries - seriesTime;
  19.  
  20.             if (difference >= 0)
  21.             {
  22.                 Console.WriteLine($"You have enough time to watch {seriesName} and left with {Math.Ceiling(difference)} minutes free time.");
  23.             }
  24.             else
  25.             {
  26.                 difference = Math.Abs(difference);
  27.                 difference = Math.Ceiling(difference);
  28.                 Console.WriteLine($"You don't have enough time to watch {seriesName}, you need {difference} more minutes.");
  29.             }
  30.         }
  31.     }
  32. }
  33.  
Advertisement
Add Comment
Please, Sign In to add comment