Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Suitcases_Load
- {
- class Program
- {
- static void Main(string[] args)
- {
- double trankCapacity = double.Parse(Console.ReadLine());
- int suitcasesCounter = 0;
- double currentTrankCapacity = trankCapacity;
- string command = Console.ReadLine();
- while (command != "End" || currentTrankCapacity > 0)
- {
- if (command == "End")
- {
- Console.WriteLine($"Congratulations! All suitcases are loaded!");
- break;
- }
- double suitcaseValue = double.Parse(command);
- if (suitcasesCounter %3==0 && suitcasesCounter !=0)
- {
- suitcaseValue += suitcaseValue*0.10;
- }
- currentTrankCapacity -= suitcaseValue;
- if (currentTrankCapacity <= 0)
- {
- Console.WriteLine($"No more space!");
- break;
- }
- command = Console.ReadLine();
- suitcasesCounter++;
- }
- Console.WriteLine($"Statistic: {suitcasesCounter} suitcases loaded.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement