Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace demo
- {
- class Program
- {
- static void Main(string[] args)
- {
- int count = int.Parse(Console.ReadLine());
- bool eggs = false;
- bool flour = false;
- bool sugar = false;
- for (int i = 1; i <= count; i++)
- {
- string command = Console.ReadLine();
- while (command != "Bake")
- {
- if (command == "sugar")
- {
- sugar = true;
- }
- else if (command == "eggs")
- {
- eggs = true;
- }
- else if (command == "flour")
- {
- flour = true;
- }
- command = Console.ReadLine();
- }
- if (command == "Bake" && eggs && sugar && flour)
- {
- Console.WriteLine($"Baking batch number {i} …");
- eggs = false;
- flour = false;
- sugar = false;
- }
- else
- {
- Console.WriteLine("The batter should contain flour, eggs and sugar!");
- i--;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement