Advertisement
Guest User

Untitled

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