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