Advertisement
EmoRz

OwnBusiness

Sep 5th, 2018
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.17 KB | None | 0 0
  1. using System;
  2.  
  3. namespace OwnBusiness
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             //input
  10.             var a = int.Parse(Console.ReadLine());
  11.             var b = int.Parse(Console.ReadLine());
  12.             var c = int.Parse(Console.ReadLine());
  13.             var volumeOfRoom = a * b * c;
  14.             var sumOfAlPc = 0;
  15.             var temp = 0;
  16.             var command = Console.ReadLine();
  17.             var check = true;
  18.             //logic
  19.  
  20.             while (command != "Done")
  21.             {
  22.                 temp = int.Parse(command);
  23.                 sumOfAlPc += temp;
  24.                 if (sumOfAlPc>volumeOfRoom)
  25.                 {
  26.                     check = false;
  27.                     var diff = sumOfAlPc - volumeOfRoom;
  28.                     Console.WriteLine($"No more free space! You need {diff} Cubic meters more.");
  29.                     break;
  30.                 }
  31.                
  32.                 command = Console.ReadLine();
  33.             }
  34.             if (check)
  35.             {
  36.                 Console.WriteLine($"{volumeOfRoom - sumOfAlPc} Cubic meters left.");
  37.             }
  38.             //output
  39.         }
  40.     }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement