Advertisement
aggressiveviking

Untitled

Feb 10th, 2020
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _10.Moving
  4. {
  5. class Moving
  6. {
  7. static void Main(string[] args)
  8. {
  9. int w = int.Parse(Console.ReadLine());
  10. int l = int.Parse(Console.ReadLine());
  11. int h = int.Parse(Console.ReadLine());
  12.  
  13. string command = Console.ReadLine();
  14.  
  15. int space = w * l * h;
  16.  
  17. int volume = 0;
  18.  
  19. while (command != "Done")
  20. {
  21. int commandNum = int.Parse(command);
  22. volume += commandNum;
  23.  
  24. if (volume >= space)
  25. {
  26. Console.WriteLine($"No more free space! You need {volume - space} Cubic meters more.");
  27. break;
  28. }
  29.  
  30. command = Console.ReadLine();
  31. }
  32.  
  33. if (volume < space)
  34. {
  35. Console.WriteLine($"{space - volume} Cubic meters left.");
  36. }
  37.  
  38. }
  39. }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement