CSharp · Console
using System;
using System.Numerics;
using System.Collections.Generic;
public class Program
{
public static void Main(string[] args)
{
var array = new int[]{1, 32, 4, 432, 2, 3, 3, 45, 563, 4, 2};
var hashSet = new HashSet<int>();
for (int i = 0; i < array.Length; i++)
{
int count = 0;
for (int j = 0; j < array.Length; j++)
{
if (array[i] == array[j])
{
count++;
}
}
if (hashSet.Add(array[i]))
Console.WriteLine($"{array[i]} appears " + count + " times");
}
}
}