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