nikolayneykov

Untitled

Oct 6th, 2018
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.73 KB | None | 0 0
  1. using System;
  2.  
  3. class Moving
  4. {
  5.     static void Main(string[] args)
  6.     {
  7.         int freeSpaceWidth = int.Parse(Console.ReadLine());
  8.         int freeSpaceLength = int.Parse(Console.ReadLine());
  9.         int freeSpaceHeight = int.Parse(Console.ReadLine());
  10.         int freeSpaceVolume = freeSpaceWidth * freeSpaceLength * freeSpaceHeight;
  11.         string input = string.Empty;
  12.         while (freeSpaceVolume > 0 && (input = Console.ReadLine()) != "Done")
  13.         {
  14.             freeSpaceVolume -= int.Parse(input);
  15.         }
  16.         Console.WriteLine(freeSpaceVolume >= 0 ?
  17.             $"{freeSpaceVolume} Cubic meters left." :
  18.             $"No more free space! You need {Math.Abs(freeSpaceVolume)} Cubic meters more.");
  19.     }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment