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