Advertisement
PetkoPedev

Untitled

May 26th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 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 Calories_Counter
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. var cheese = 0;
  14. var tomatoSause = 0;
  15. var salami = 0;
  16. var pepper = 0;
  17. var totalCalories = 0;
  18. int n = int.Parse(Console.ReadLine());
  19. for (int i = 0; i < n; i++)
  20. {
  21. var ingredients = Console.ReadLine().ToLower();
  22. if(ingredients == "cheese")
  23. {
  24. cheese += 500;
  25. }
  26. else if(ingredients == "tomato sause")
  27. {
  28. tomatoSause += 150;
  29. }
  30. else if(ingredients == "salami")
  31. {
  32. salami += 600;
  33. }
  34. else if(ingredients == "pepper")
  35. {
  36. pepper += 50;
  37. }
  38. totalCalories = cheese + tomatoSause + salami + pepper;
  39. }
  40. //totalCalories = cheese + tomatoSause + salami + pepper;
  41. Console.WriteLine("Total calories: {0}", totalCalories);
  42. }
  43. }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement