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