Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Zhani
- {
- class MainClass
- {
- public static void Main(string[] args)
- {
- int windhtSpace = int.Parse(Console.ReadLine());
- int lenghtSpace = int.Parse(Console.ReadLine());
- int heightSpace = int.Parse(Console.ReadLine());
- int totalSpace = windhtSpace * lenghtSpace * heightSpace;
- int sum = 0;
- string command = Console.ReadLine();
- while (command != "Done")
- {
- int cartons = int.Parse(command);
- sum += cartons;
- if (totalSpace < sum)
- {
- double needs = sum - totalSpace;
- Console.WriteLine($"No more free space! You need {needs} Cubic meters more.");
- break;
- }
- command = Console.ReadLine();
- }
- if (command == "Done")
- {
- double lefts = totalSpace - sum;
- Console.WriteLine($"{lefts} Cubic meters left.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment