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