YankoGrancharov

calorieCounter

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