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