VelizarAvramov

04. Elevator

Nov 5th, 2018
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.59 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _04._Elevator
  4. {
  5.     class Elevator
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             //Calculate how many courses will be needed to elevate n persons by using an elevator of capacity of p persons. The input
  10.             //holds two lines: the number of people n and the capacity p of the elevator.
  11.             int persons = int.Parse(Console.ReadLine());
  12.             int capacity = int.Parse(Console.ReadLine());
  13.  
  14.             int courses = (int)Math.Ceiling((double)persons / capacity);
  15.             Console.WriteLine(courses);
  16.         }
  17.     }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment