public static void Main()
int[] vetor = new int[] {4,2,5,4,3,5,2,2,4};
int[] qtds = new int[vetor.Length];
int[] ns = new int[vetor.Length];
for (int i = 0; i < vetor.Length; i++)
for (int k = 0; k < nDistintos; k++)
for (int j = i ; j < vetor.Length; j++)
if (vetor[j] == vetor[i])
ns[nDistintos] = vetor[i];
for (int i =0; i < nDistintos; i++)
Console.WriteLine("Numero " + ns[i] + " aparece " + qtds[i] + " vezes");