Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace _08.Calories_Counter_2
- {
- class Program
- {
- static void Main(string[] args)
- {
- int n = int.Parse(Console.ReadLine());
- var cheeseCnt = 0;
- var tommatoSauceCnt = 0;
- var salamiCnt = 0;
- var pepperCnt = 0;
- string product = "";
- for (int i = 1; i <= n; i++)
- {
- product = Console.ReadLine().ToLower();
- if (product == "Cheese")
- {
- cheeseCnt += 500;
- }
- else if (product == "Tomato sauce ")
- {
- tommatoSauceCnt += 150;
- }
- else if (product == "Salami")
- {
- salamiCnt += 600;
- }
- else if (product == "Pepper ")
- {
- pepperCnt += 50;
- }
- var totalProductsCnt = cheeseCnt + tommatoSauceCnt + salamiCnt + pepperCnt;
- Console.WriteLine($"Total calories: {totalProductsCnt}");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement