Advertisement
dragonbs

Lunch break

Sep 24th, 2022
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.98 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _08.LunchBreak
  4. {
  5.     internal class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             string nameOfFilm = Console.ReadLine();
  10.             int timeOfFilm = int.Parse(Console.ReadLine());
  11.             int lunchBreak = int.Parse(Console.ReadLine());
  12.  
  13.             double timeForObqd = lunchBreak * 0.125;
  14.             double timeForPochivka = lunchBreak * 0.25;
  15.  
  16.             double allNededTime = timeOfFilm + timeForObqd + timeForPochivka;
  17.  
  18.             double difference = Math.Abs(lunchBreak - allNededTime);
  19.  
  20.             if (lunchBreak - allNededTime >= 0)
  21.             {
  22.                 Console.WriteLine($"You have enough time to watch {nameOfFilm} and left with {Math.Ceiling(difference)} minutes free time.");
  23.             }
  24.             else
  25.             {
  26.                 Console.WriteLine($"You don't have enough time to watch {nameOfFilm}, you need {Math.Ceiling(difference)} more minutes.");
  27.             }
  28.         }
  29.     }
  30. }
  31.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement