Advertisement
nevenailievaa

08.LunchBreak

Nov 10th, 2024
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.72 KB | None | 0 0
  1. //Input
  2. string seriesName = Console.ReadLine();
  3. int episodeLength = int.Parse(Console.ReadLine());
  4. int breakLength = int.Parse(Console.ReadLine());
  5.  
  6. //Calculations
  7. double lunchTime = breakLength / 8.0;
  8. double freeTime = breakLength / 4.0;
  9. double neededTime = episodeLength + lunchTime + freeTime;
  10.  
  11. //Output
  12. if (breakLength >= neededTime)
  13. {
  14.     double remainingTime = breakLength - neededTime;
  15.     Console.WriteLine($"You have enough time to watch {seriesName} and left with {Math.Ceiling(remainingTime)} minutes free time.");
  16. }
  17. else
  18. {
  19.     double notEnoughTime = neededTime - breakLength;
  20.     Console.WriteLine($"You don't have enough time to watch {seriesName}, you need {Math.Ceiling(notEnoughTime)} more minutes.");
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement