Advertisement
MARINA_GREBENAROVA

Moving

Oct 15th, 2021
812
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.93 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Moving
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int length = int.Parse(Console.ReadLine());
  10.             int width = int.Parse(Console.ReadLine());
  11.             int height = int.Parse(Console.ReadLine());
  12.  
  13.             int allCubic = length * width * height;
  14.  
  15.             while (allCubic > 0)
  16.             {
  17.                 string input = Console.ReadLine();
  18.                 if (input == "Done")
  19.                 {
  20.                     break;
  21.                 }
  22.                 int box = int.Parse(input);
  23.                 allCubic -= box;
  24.             }
  25.             if (allCubic >= 0)
  26.             {
  27.                 Console.WriteLine($"{allCubic} Cubic meters left.");
  28.             }
  29.             else
  30.             {
  31.                 Console.WriteLine($"No more free space! You need {Math.Abs(allCubic)} Cubic meters more.");
  32.             }
  33.         }
  34.     }
  35. }
  36.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement