Advertisement
nnikolov

Untitled

Mar 28th, 2020
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 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. break;
  20. }
  21. double bag = double.Parse(command);
  22.  
  23. if (counter3 == 3)
  24. {
  25. capacity -= bag + (bag * 0.10);
  26. counter3 = 0;
  27. }
  28. else
  29. {
  30. capacity -= bag;
  31. }
  32. if(capacity<=0)
  33. {
  34. Console.WriteLine($"No more space!");
  35. Console.WriteLine($"Statistic: { counterbags} suitcases loaded.");
  36. return;
  37.  
  38. }
  39. counterbags++;
  40. }
  41. Console.WriteLine($"Congratulations! All suitcases are loaded!");
  42. Console.WriteLine($"Statistic: {counterbags} suitcases loaded.");
  43.  
  44.  
  45. }
  46. }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement