Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace DomashnoMoving
- {
- class Program
- {
- static void Main(string[] args)
- {
- int widthApartment = int.Parse(Console.ReadLine());
- int lenghtApartment = int.Parse(Console.ReadLine());
- int hightApartment = int.Parse(Console.ReadLine());
- double volumeBoxes = 1.00;
- double volumeApartment = 1.00 * widthApartment * lenghtApartment * hightApartment;
- while (true)
- {
- string inputData = Console.ReadLine().ToLower();
- if (inputData != "done")
- {
- int numberBoxes = int.Parse(inputData);
- double volumeOccupied = 1.00 * numberBoxes * volumeBoxes;
- volumeApartment -= volumeOccupied;
- if (volumeApartment < 0)
- {
- break;
- }
- }
- else
- {
- break;
- }
- }
- if (volumeApartment >= 0)
- {
- Console.WriteLine($"{volumeApartment} Cubic meters left.");
- }
- else
- {
- double spaceNeeded = -1.00 * volumeApartment;
- Console.WriteLine($"No more free space! You need {spaceNeeded} Cubic meters more.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement