Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _03.Elevator
- {
- class Elevator
- {
- static void Main(string[] args)
- {
- int numPeople = int.Parse(Console.ReadLine());
- int capacity = int.Parse(Console.ReadLine());
- int temp = numPeople;
- int cources = 0;
- if (numPeople < capacity)
- {
- Console.WriteLine("All the persons fit inside in the elevator.");
- Console.WriteLine("Only one course is needed.");
- }
- else if (numPeople % capacity == 0)
- {
- while (numPeople >= capacity)
- {
- numPeople -= capacity;
- cources++;
- }
- Console.WriteLine($"{cources} courses * {capacity} people");
- }
- else
- {
- while (numPeople > capacity)
- {
- numPeople -= capacity;
- cources++;
- }
- Console.WriteLine($"{cources} cources * {capacity} people");
- Console.WriteLine($"+ 1 cources * {temp-(cources * capacity)} people");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment