Advertisement
refreshable

Untitled

May 27th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 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 totalProductsCnt = 0;
  15. string product = "";
  16.  
  17. for (int i = 1; i <= n; i++)
  18. {
  19. product = Console.ReadLine().ToLower();
  20. if (product == "cheese")
  21. {
  22. totalProductsCnt += 500;
  23. }
  24. if (product == "tomato sauce")
  25. {
  26. totalProductsCnt += 150;
  27. }
  28. if (product == "salami")
  29. {
  30. totalProductsCnt += 600;
  31. }
  32. if (product == "pepper")
  33. {
  34. totalProductsCnt += 50;
  35. }
  36.  
  37. }
  38.  
  39. Console.WriteLine($"Total calories: {totalProductsCnt}");
  40.  
  41. }
  42. }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement