Zhaniartt

Untitled

Nov 4th, 2018
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Zhani
  4. {
  5. class MainClass
  6. {
  7. public static void Main(string[] args)
  8. {
  9. int windhtSpace = int.Parse(Console.ReadLine());
  10. int lenghtSpace = int.Parse(Console.ReadLine());
  11. int heightSpace = int.Parse(Console.ReadLine());
  12.  
  13.  
  14. int totalSpace = windhtSpace * lenghtSpace * heightSpace;
  15. int sum = 0;
  16. string command = Console.ReadLine();
  17.  
  18. while (command != "Done")
  19. {
  20. int cartons = int.Parse(command);
  21. sum += cartons;
  22. if (totalSpace < sum)
  23. {
  24. double needs = sum - totalSpace;
  25. Console.WriteLine($"No more free space! You need {needs} Cubic meters more.");
  26. break;
  27. }
  28. command = Console.ReadLine();
  29. }
  30.  
  31. if (command == "Done")
  32. {
  33. double lefts = totalSpace - sum;
  34. Console.WriteLine($"{lefts} Cubic meters left.");
  35. }
  36. }
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment