Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- public class Program
- {
- public static void Main()
- {
- int[] numbers = {1, 5, 15, 5, 1, 1, 5, 15};
- Dictionary<int, int> st = new Dictionary<int, int>();
- foreach(int num in numbers)
- {
- if(st.ContainsKey(num))
- {
- st[num]++;
- }
- else
- {
- st[num]= 1;
- }
- }
- foreach( var el in st)
- {
- Console.WriteLine("{0} -> {1}", el.Key, el.Value);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement