Advertisement
grigorb57

Ingredients

Jul 4th, 2018
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.76 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApp1
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int counter = 0;
  14.  
  15.             while (true)
  16.             {
  17.                 string inputIngredient = Console.ReadLine();
  18.  
  19.                 if(inputIngredient == "Bake!")
  20.                 {
  21.                     Console.WriteLine($"Preparing cake with {counter} ingredients.");
  22.                     break;
  23.                 }
  24.                 else
  25.                 {
  26.                     Console.WriteLine($"Adding ingredient {inputIngredient}.");
  27.                     counter++;
  28.                 }
  29.             }
  30.  
  31.         }
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement