Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace problem8CaloriesCounter
- {
- class problem8CaloriesCounter
- {
- static void Main()
- {
- int ingredientNums = int.Parse(Console.ReadLine());
- int caloriesCOUNT = 0;
- for (int i = 0; i < ingredientNums; i++)
- {
- string ingredient = Console.ReadLine().ToLower();
- if (ingredient == "cheese")
- {
- caloriesCOUNT += 500;
- }
- else if (ingredient == "tomato sauce")
- {
- caloriesCOUNT += 150;
- }
- else if (ingredient == "salami")
- {
- caloriesCOUNT += 600;
- }
- else if (ingredient == "pepper")
- {
- caloriesCOUNT += 50;
- }
- }
- Console.WriteLine($"Total calories: {caloriesCOUNT}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment