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 totalProductsCnt = 0;
- string product = "";
- for (int i = 1; i <= n; i++)
- {
- product = Console.ReadLine().ToLower();
- if (product == "cheese")
- {
- totalProductsCnt += 500;
- }
- if (product == "tomato sauce")
- {
- totalProductsCnt += 150;
- }
- if (product == "salami")
- {
- totalProductsCnt += 600;
- }
- if (product == "pepper")
- {
- totalProductsCnt += 50;
- }
- }
- Console.WriteLine($"Total calories: {totalProductsCnt}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement