Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace Ex8_CaloriesCounter
- {
- using System;
- public class Program
- {
- public static void Main(string[] args)
- {
- int n = int.Parse(Console.ReadLine());
- int cal = 0;
- int sum = 0;
- for (int i = 1; i <= n; i++)
- {
- string ingrediends = Console.ReadLine();
- if (ingrediends.Equals("cheese", StringComparison.InvariantCultureIgnoreCase))
- {
- cal = 500;
- }
- else if (ingrediends.Equals("toMatO sauce", StringComparison.InvariantCultureIgnoreCase))
- {
- cal = 150;
- }
- else if (ingrediends.Equals("salami", StringComparison.InvariantCultureIgnoreCase))
- {
- cal = 600;
- }
- else if (ingrediends.Equals("pepper", StringComparison.InvariantCultureIgnoreCase))
- {
- cal = 50;
- }
- if (ingrediends.Equals("cheese", StringComparison.InvariantCultureIgnoreCase) ||
- ingrediends.Equals("toMatO sauce", StringComparison.InvariantCultureIgnoreCase) ||
- ingrediends.Equals("salami", StringComparison.InvariantCultureIgnoreCase) ||
- ingrediends.Equals("pepper", StringComparison.InvariantCultureIgnoreCase))
- {
- sum += cal;
- }
- }
- Console.WriteLine($"Total calories: {sum}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment