kirililchev3

Cake Ingredient - for loop

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