Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Moving2
- {
- class Program
- {
- static void Main(string[] args)
- {
- double weight = double.Parse(Console.ReadLine());
- double lenght = double.Parse(Console.ReadLine());
- double height = double.Parse(Console.ReadLine());
- double roomVolume = weight * lenght * height;
- string command = Console.ReadLine();
- bool isThereEnoughSpace = true;
- while (command != "Done")
- {
- double boxes = double.Parse(command);
- roomVolume -= boxes;
- if (roomVolume < 0)
- {
- isThereEnoughSpace = false;
- break;
- }
- command = Console.ReadLine();
- }
- if (isThereEnoughSpace)
- {
- Console.WriteLine($"{roomVolume} Cubic meters left.");
- }
- else
- {
- Console.WriteLine($"No more free space! You need {Math.Abs(roomVolume)} Cubic meters more.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement