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 Training_18_02_2019_Moving_While_Loop
- {
- class Program
- {
- static void Main(string[] args)
- {
- int w = int.Parse(Console.ReadLine());
- int l = int.Parse(Console.ReadLine());
- int h = int.Parse(Console.ReadLine());
- string comand = Console.ReadLine();
- int capacityRoom = w * l * h;
- int boxes = 0;
- while (comand != "Done")
- {
- boxes += int.Parse(comand);
- if (capacityRoom <= boxes)
- {
- Console.WriteLine($"No more free space! You need {boxes - capacityRoom} Cubic meters more.");
- break;
- }
- comand = Console.ReadLine();
- }
- if (comand == "Done")
- {
- Console.WriteLine($"{capacityRoom - boxes} Cubic meters left.");
- return;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement