Advertisement
koksibg

Cake_Ingredients

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