Advertisement
Dianov

Data Types and Variables - Exercise (03. Elevator)

Aug 7th, 2021
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.79 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Elevator
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int numberOfPeople = int.Parse(Console.ReadLine());
  10.             int capacity = int.Parse(Console.ReadLine());
  11.            
  12.             if (capacity >= numberOfPeople)
  13.             {
  14.                 Console.WriteLine(1);
  15.             }
  16.             else if (capacity < numberOfPeople)
  17.             {
  18.                 if (numberOfPeople % capacity != 0)
  19.                 {
  20.                     int courses = numberOfPeople / capacity + 1;
  21.                     Console.WriteLine(courses);
  22.                 }
  23.                 else
  24.                 {
  25.                     Console.WriteLine(numberOfPeople / capacity);
  26.                 }
  27.             }          
  28.         }
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement