Advertisement
nnikolov

Untitled

Mar 28th, 2020
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 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. }
  27. else
  28. {
  29. capacity -= bag;
  30. }
  31. if(capacity<=0)
  32. {
  33. Console.WriteLine($"No more space! Statistic: {counterbags} suitcases loaded.");
  34. return;
  35.  
  36. }
  37. counterbags++;
  38. }
  39. Console.WriteLine($"Congratulations! All suitcases are loaded! Statistic: {counterbags} suitcases loaded.");
  40.  
  41. }
  42. }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement