using System;
using System.Collections.Generic;
class Program
{
static void Main()
{
int[] array = { 2, 3, 4, 2, 1, 3, 4 };
Dictionary<int, int> frequencyMap = new Dictionary<int,
int>();
foreach (int num in array)
{
if (frequencyMap.ContainsKey(num))
{
frequencyMap[num]++;
}
else
{
frequencyMap[num] = 1;
}
}
foreach (KeyValuePair<int, int> entry in frequencyMap)
{
Console.WriteLine(entry.Key + " -> " + entry.Value);
}
}
}
To embed this program on your website, copy the following code and paste it into your website's HTML: