Advertisement
Guest User

1va

a guest
Mar 24th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.69 KB | None | 0 0
  1. static void Main(string[] args)
  2.         {
  3.             Dictionary<string, int> uredi = new Dictionary<string, int>();
  4.             uredi.Add("treadmill", 5899);
  5.             uredi.Add("cross trainer", 1699);
  6.             uredi.Add("dumbbells", 579);
  7.             uredi.Add("exercise bike", 1789);
  8.  
  9.             int n = int.Parse(Console.ReadLine());
  10.             int sum = 0;
  11.  
  12.             string input = "";
  13.             for (int i = 0; i < n; i++)
  14.             {
  15.                 input = Console.ReadLine();
  16.                 if (uredi.ContainsKey(input))
  17.                 {
  18.                     sum += uredi[input];
  19.                 }
  20.             }
  21.             Console.WriteLine($"sum:f2");
  22.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement