frxbg

01. SoftUni Reception

Jul 1st, 2018
520
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.75 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ExamOne_SoftUni_Reception
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int studentsAnswerPerHour = 0;
  10.            
  11.             for (int i = 1; i <= 3; i++)
  12.             {
  13.                 studentsAnswerPerHour += int.Parse(Console.ReadLine());
  14.             }
  15.  
  16.             int studentsCount = int.Parse(Console.ReadLine());
  17.  
  18.             int hours = 0;
  19.  
  20.             while (studentsCount > 0)
  21.             {
  22.                 studentsCount -= studentsAnswerPerHour;
  23.                 hours++;
  24.                 if (hours % 4 == 0)
  25.                 {
  26.                     hours++;
  27.                 }
  28.             }
  29.  
  30.             Console.WriteLine($"Time needed: {hours}h.");
  31.         }
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment