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