Advertisement
refreshable

Untitled

May 26th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 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 _08.Calories_Counter_2
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. int n = int.Parse(Console.ReadLine());
  14. var cheeseCnt = 0;
  15. var tommatoSauceCnt = 0;
  16. var salamiCnt = 0;
  17. var pepperCnt = 0;
  18.  
  19. string product = "";
  20. for (int i = 1; i <= n; i++)
  21. {
  22. product = Console.ReadLine().ToLower();
  23. if (product == "Cheese")
  24. {
  25. cheeseCnt += 500;
  26. }
  27. else if (product == "Tomato sauce ")
  28. {
  29. tommatoSauceCnt += 150;
  30. }
  31. else if (product == "Salami")
  32. {
  33. salamiCnt += 600;
  34. }
  35. else if (product == "Pepper ")
  36. {
  37. pepperCnt += 50;
  38. }
  39.  
  40. var totalProductsCnt = cheeseCnt + tommatoSauceCnt + salamiCnt + pepperCnt;
  41. Console.WriteLine($"Total calories: {totalProductsCnt}");
  42.  
  43. }
  44.  
  45.  
  46. }
  47. }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement