good, the program consists of making a series of rolls N of a dice and counting the number of times a number ordered by screen. This is the code I have made but something is wrong with the counter :( Thanks in advance.
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define N 500
#define M 6
void obtenerRonda( int A[] ) {
int array[N];
int i;
srand( time( NULL ) );
for( i = 0; i < N; i++ ) {
array[i] = 1 + ( rand( ) % M );
printf( "-%d-", array[i] );
}
}
int repeticion( int V[] ) {
int i ;
int t = 0;
int numero;
printf( "\nQue numero quieres saber cuantas veces se ha repetido" );
scanf( "%d", &numero );
for( i = 0; i < N; i++ ) {
if( V[i] == numero ) {
t++;
}
}
printf( "el numero %d se repite %d veces ", numero, t );
}
int main( void ){
int A[N];
obtenerRonda( A );
repeticion( A );
}