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