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