Advertisement
silvana1303

lunch break

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