Advertisement
nnikolov

Untitled

Mar 28th, 2020
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. using System;
  2.  
  3. namespace asd123asd123
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. double capacity = double.Parse(Console.ReadLine());
  10.  
  11. int counterbags = 0;
  12. int counter3 = 0;
  13.  
  14. while (true)
  15. {
  16. string command = Console.ReadLine();
  17. if(command == "End")
  18. {
  19. Console.WriteLine($"Congratulations! All suitcases are loaded!");
  20. Console.WriteLine($"Statistic: {counterbags} suitcases loaded.");
  21. break;
  22. }
  23. double bag = double.Parse(command);
  24.  
  25. if (counter3 == 3)
  26. {
  27. capacity -= bag + (bag * 0.10);
  28. counter3 = 0;
  29. }
  30. else
  31. {
  32. capacity -= bag;
  33. }
  34. if(capacity<=0)
  35. {
  36. Console.WriteLine($"No more space!");
  37. Console.WriteLine($"Statistic: { counterbags} suitcases loaded.");
  38. break;
  39.  
  40. }
  41. counterbags++;
  42. }
  43.  
  44.  
  45.  
  46.  
  47. }
  48. }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement