Advertisement
Yanislav29

Untitled

Nov 22nd, 2019
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.55 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 ConsoleApp3
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. int numberOfBatches = int.Parse(Console.ReadLine());
  14. bool flourcontain = false;
  15. bool sugarcontain = false;
  16. bool eggscontain = false;
  17. int bakingCnt = 0;
  18. for(int batches = 0; batches < numberOfBatches; batches++)
  19. {
  20. string product = Console.ReadLine();
  21. while(product != "Bake")
  22. {
  23. if (product == "flour") flourcontain = true;
  24. if (product == "sugar") sugarcontain = true;
  25. if (product == "eggs") eggscontain = true;
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33. product = Console.ReadLine();
  34. }
  35. if(flourcontain && eggscontain && sugarcontain)
  36. {
  37. bakingCnt++;
  38. Console.WriteLine($"Baking batch number {bakingCnt}...");
  39. flourcontain = false;
  40. sugarcontain = false;
  41. eggscontain = false;
  42. }
  43. else
  44. {
  45. batches--;
  46. Console.WriteLine("The batter should contain flour, eggs and sugar!");
  47. }
  48. }
  49.  
  50. }
  51. }
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement