veronikaaa86

07. Cake Ingredients

Jan 31st, 2018
261
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.70 KB | None | 0 0
  1. namespace Ex7_CakeIngredients
  2. {
  3.     using System;
  4.     public class Program
  5.     {
  6.         public static void Main(string[] args)
  7.         {
  8.             string ingrediends = "";
  9.             int counter = 0; ;
  10.  
  11.             for (int i = 1; ; i++)
  12.             {
  13.                 ingrediends = Console.ReadLine();
  14.  
  15.                 if (ingrediends != "Bake!")
  16.                 {
  17.                     Console.WriteLine($"Adding ingredient {ingrediends}.");
  18.                 }
  19.                 else if (ingrediends == "Bake!")
  20.                 {
  21.                     Console.WriteLine($"Preparing cake with {i-1} ingredients.");
  22.                     break;
  23.                 }
  24.             }
  25.         }
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment