Advertisement
Guest User

Untitled

a guest
Feb 29th, 2020
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. using System;
  2.  
  3. namespace OwnBussiness
  4. {
  5. class Program
  6. {
  7. static void Main()
  8. {
  9. int width = int.Parse(Console.ReadLine());
  10. int lenght = int.Parse(Console.ReadLine());
  11. int height = int.Parse(Console.ReadLine());
  12.  
  13. string input = Console.ReadLine();
  14.  
  15. int leeway = 0;
  16. int occupied = 0;
  17. int space = 0;
  18.  
  19. while (input != "Done")
  20. {
  21. int compcount = int.Parse(input);
  22. occupied += compcount;
  23. leeway = width * lenght * height;
  24.  
  25. if (occupied > leeway)
  26. {
  27. space = Math.Abs(occupied - leeway);
  28. Console.WriteLine($"No more free space! You need {space} Cubic meters more.");
  29. break;
  30. }
  31. input = Console.ReadLine();
  32. }
  33.  
  34. if (leeway > occupied)
  35. {
  36. space = leeway - occupied;
  37. Console.WriteLine($"{space} Cubic meters left.");
  38. }
  39.  
  40. }
  41. }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement