Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq.Expressions;
- namespace Add_Bags
- {
- class Program
- {
- static void Main(string[] args)
- {
- int countEggs = int.Parse(Console.ReadLine());
- int totalEggs = 0;
- totalEggs += countEggs;
- while (true)
- {
- string line = Console.ReadLine();
- int eggs = int.Parse(Console.ReadLine());
- if (line == "Close")
- {
- Console.WriteLine("Store is closed!");
- Console.WriteLine($"{totalEggs} eggs sold.");
- break;
- }
- if (line == "Fill")
- {
- totalEggs += eggs;
- }
- if (eggs > totalEggs)
- {
- Console.WriteLine("Not enough eggs in store!");
- Console.WriteLine($"You can buy only {totalEggs}.");
- break;
- }
- if (line == "Buy")
- {
- totalEggs -= eggs;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement