Advertisement
IvanITD

08.LunchBreak

Jan 15th, 2024
693
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.67 KB | Source Code | 0 0
  1. string serialName = Console.ReadLine();
  2. int episodeLength = int.Parse(Console.ReadLine());
  3. int restLength = int.Parse(Console.ReadLine());
  4.  
  5. double timeForLunch = restLength * 0.125;
  6. double timeForRest = restLength * 0.25;
  7. double remainingTime = restLength - timeForLunch - timeForRest;
  8.  
  9.  
  10. if (remainingTime >= episodeLength)
  11. {
  12.     Console.WriteLine($"You have enough time to watch {serialName} and left with {Math.Ceiling(remainingTime - episodeLength)} minutes free time.");
  13. }
  14. else if (remainingTime < episodeLength)
  15. {
  16.    
  17.     Console.WriteLine($"You don't have enough time to watch {serialName}, you need {Math.Ceiling(episodeLength - remainingTime)} more minutes.");
  18. }
  19.  
Tags: C#
Advertisement
Comments
Add Comment
Please, Sign In to add comment
Advertisement