Advertisement
OOrlin

Untitled

Nov 5th, 2019
319
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Moving2
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. double weight = double.Parse(Console.ReadLine());
  10. double lenght = double.Parse(Console.ReadLine());
  11. double height = double.Parse(Console.ReadLine());
  12.  
  13. double roomVolume = weight * lenght * height;
  14. string command = Console.ReadLine();
  15. bool isThereEnoughSpace = true;
  16.  
  17. while (command != "Done")
  18. {
  19. double boxes = double.Parse(command);
  20. roomVolume -= boxes;
  21.  
  22. if (roomVolume < 0)
  23. {
  24. isThereEnoughSpace = false;
  25. break;
  26.  
  27. }
  28. command = Console.ReadLine();
  29.  
  30.  
  31. }
  32. if (isThereEnoughSpace)
  33. {
  34. Console.WriteLine($"{roomVolume} Cubic meters left.");
  35. }
  36. else
  37. {
  38. Console.WriteLine($"No more free space! You need {Math.Abs(roomVolume)} Cubic meters more.");
  39. }
  40.  
  41.  
  42.  
  43.  
  44.  
  45. }
  46. }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement