Hi!
I wrote this program to generate a keyboard determined random numbers.
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int amount, aleatory_numbers;
int array[70];
int counter=0;
int generator ()
{
printf ("Introduce the amount of numbers that you wish: ");
scanf ("%d", &amount);
srand ( time(NULL) );
do
{
aleatory_numbers = rand() % 49 + 1;
counter++;
array[counter]=aleatory_numbers;
printf ("%d", array[counter]);
}
while (counter!=amount);
system("pause");
return array[counter],counter;
}
int main ()
{
generator();
}
It works, but now I need to display on screen the frequency of each numbers of the array. How can I do that? I've tried lots of things, but I can't do that.
Thanks.