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
- {
- class Program
- {
- static void Main(string[] args)
- {
- int n = int.Parse(Console.ReadLine());
- Dictionary<string, int> ValidIngredients = new Dictionary<string, int>()
- {
- { "cheese", 500 }, { "tomato sauce", 150 }, { "salami", 600 }, { "pepper", 50 }
- };
- int calories = 0;
- for (int i = 0; i < n; i++)
- {
- string input = Console.ReadLine().ToLower();
- if (ValidIngredients.ContainsKey(input))
- {
- calories += ValidIngredients[input];
- }
- }
- Console.WriteLine($"Total calories: {calories}");
- }
- }
- }
Add Comment
Please, Sign In to add comment