Advertisement
nnikolov

Untitled

Mar 28th, 2020
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 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!");
  34. Console.WriteLine($"Statistic: { counterbags} suitcases loaded.");
  35. return;
  36.  
  37. }
  38. counterbags++;
  39. }
  40. Console.WriteLine($"Congratulations! All suitcases are loaded!");
  41. Console.WriteLine($"Statistic: {counterbags} suitcases loaded.");
  42.  
  43.  
  44. }
  45. }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement