Advertisement
bacco

Calories Counter

May 16th, 2018
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.91 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ΠšΡƒΠΏΠ°
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int n = int.Parse(Console.ReadLine());
  10.             var calories = 0;
  11.  
  12.             for (int i = 0; i < n; i++)
  13.             {
  14.                 var ingredient = Console.ReadLine().ToLower();
  15.  
  16.                 if (ingredient == "cheese")
  17.                 {
  18.                     calories += 500;
  19.                 }
  20.                 else if (ingredient == "tomato sauce")
  21.                 {
  22.                     calories += 150;
  23.                 }
  24.                 else if (ingredient == "salami")
  25.                 {
  26.                     calories += 600;
  27.                 }
  28.                 else if (ingredient == "pepper")
  29.                 {
  30.                     calories += 50;
  31.                 }
  32.             }
  33.             Console.WriteLine($"Total calories: {calories}");
  34.         }
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement