Advertisement
Daniel_007

01. National Court - Mid Exam

Feb 29th, 2020
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.89 KB | None | 0 0
  1. using System;
  2.  
  3. namespace 01. National Court
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int firstEmployyee = int.Parse(Console.ReadLine());
  10.             int secondEmployyee = int.Parse(Console.ReadLine());
  11.             int thirdEmployyee = int.Parse(Console.ReadLine());
  12.             int howManyPeople = int.Parse(Console.ReadLine());
  13.  
  14.             int sumPerHour = firstEmployyee + secondEmployyee + thirdEmployyee;
  15.             int hours = 0;
  16.            
  17.             while (true)
  18.             {
  19.                 if (howManyPeople <= 0)
  20.                 {
  21.                     break;
  22.                 }
  23.                 hours++;
  24.                 if (hours % 4 == 0)
  25.                 {
  26.                     hours++;
  27.                 }
  28.                 howManyPeople -= sumPerHour;
  29.             }
  30.             Console.WriteLine($"Time needed: {hours}h.");
  31.         }
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement