Advertisement
Guest User

Untitled

a guest
May 26th, 2017
352
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.67 KB | None | 0 0
  1.         static void Main(string[] args)
  2.         {
  3.             int n = int.Parse(Console.ReadLine());
  4.             string ingr;
  5.             int calls = 0;
  6.             for (int i = 0; i < n; i++)
  7.             {
  8.                 ingr = Console.ReadLine().ToLower();
  9.                 if (ingr == "tomato sauce")
  10.                 { calls = calls + 150; }
  11.                 if (ingr == "cheese")
  12.                 { calls = calls + 500; }
  13.                 if (ingr == "salami")
  14.                 { calls = calls + 600; }
  15.                 if (ingr == "pepper")
  16.                 { calls = calls + 50; }
  17.             }
  18.             Console.WriteLine("Total calories: " + calls);
  19.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement