Advertisement
MARINA_GREBENAROVA

Lunch Break

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