Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int length = int.Parse(Console.ReadLine());
- int width = int.Parse(Console.ReadLine());
- int hight = int.Parse(Console.ReadLine());
- int totalVolume = length * width * hight;
- while (totalVolume >= 0)
- {
- string input = Console.ReadLine();
- if (input == "Done")
- {
- break;
- }
- else
- {
- int currentNumberOfCartons = int.Parse(input);
- totalVolume -= currentNumberOfCartons;
- }
- }
- if (totalVolume > 0)
- {
- Console.WriteLine($"{totalVolume} Cubic meters left.");
- }
- else
- {
- Console.WriteLine($"No more free space! You need {Math.Abs(totalVolume)} Cubic meters more.");
- }
Advertisement
Add Comment
Please, Sign In to add comment