Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApp3
- {
- class Program
- {
- static void Main(string[] args)
- {
- int numberOfBatches = int.Parse(Console.ReadLine());
- bool flourcontain = false;
- bool sugarcontain = false;
- bool eggscontain = false;
- int bakingCnt = 0;
- for(int batches = 0; batches < numberOfBatches; batches++)
- {
- string product = Console.ReadLine();
- while(product != "Bake")
- {
- if (product == "flour") flourcontain = true;
- if (product == "sugar") sugarcontain = true;
- if (product == "eggs") eggscontain = true;
- product = Console.ReadLine();
- }
- if(flourcontain && eggscontain && sugarcontain)
- {
- bakingCnt++;
- Console.WriteLine($"Baking batch number {bakingCnt}...");
- flourcontain = false;
- sugarcontain = false;
- eggscontain = false;
- }
- else
- {
- batches--;
- Console.WriteLine("The batter should contain flour, eggs and sugar!");
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement