Advertisement
Guest User

Untitled

a guest
Nov 30th, 2019
1,136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _09._Moving
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. int width = int.Parse(Console.ReadLine());
  10. int length = int.Parse(Console.ReadLine());
  11. int height = int.Parse(Console.ReadLine());
  12. int freespace = width * length * height;
  13. int sum = 0;
  14. string command = Console.ReadLine();
  15.  
  16. while (command != "Done")
  17. {
  18. int currentCubic = int.Parse(command);
  19. sum += currentCubic;
  20. if (freespace < sum)
  21. {
  22. int neededCubics = sum - freespace;
  23. Console.WriteLine($"No more free space! You need {neededCubics} Cubic meters more.");
  24. break;
  25. }
  26. command = Console.ReadLine();
  27. }
  28. if (command == "Done")
  29. {
  30. int freeCubics = freespace - sum;
  31. Console.WriteLine($"{freeCubics} Cubic meters left.");
  32. }
  33.  
  34. }
  35. }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement