Advertisement
petarkobakov

Suitcases load

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