Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _07._Cake_Ingredients
- {
- class CakeIngredients
- {
- static void Main(string[] args)
- {
- //Write a baking program, which takes as an input ingredients and writes a message when the ingredient is in the system.
- //For every given ingredient, you should write: “Adding ingredient {name of the ingredient}.”. When you receive the command
- //“Bake!” from the console you should stop the program and write “Preparing cake with {number of given ingredients}
- //ingredients.”.
- string ingredient = Console.ReadLine();
- int count = 0;
- while (ingredient != "Bake!")
- {
- Console.WriteLine($"Adding ingredient {ingredient}.");
- count++;
- ingredient = Console.ReadLine();
- }
- Console.WriteLine($"Preparing cake with {count} ingredients.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment