Advertisement
Guest User

Untitled

a guest
May 27th, 2020
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Suitcases_Load
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. double capacityTrunk = double.Parse(Console.ReadLine());
  10. double freeSpace = 0;
  11. int countLuggade = 0;
  12. string command = Console.ReadLine();
  13. while(command != "End")
  14. {
  15. double volumeTrunk = double.Parse(command);
  16. countLuggade++;
  17. volumeTrunk++;
  18. freeSpace += volumeTrunk;
  19. capacityTrunk-=volumeTrunk;
  20. if (countLuggade % 3 == 0)
  21. {
  22. volumeTrunk *= 0.10;
  23. }
  24. if (volumeTrunk > freeSpace)
  25. {
  26.  
  27. Console.WriteLine("No more space!");
  28. break;
  29. }
  30. command = Console.ReadLine();
  31. }
  32. if (command == "End")
  33. {
  34. Console.WriteLine("Congratulations! All suitcases are loaded!");
  35. }
  36. Console.WriteLine($"Statistic: {countLuggade} suitcases loaded.");
  37.  
  38. }
  39. }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement