I guess i am writing the correct code but still the output is not proper. Here's the algorithm i am trying-
->generate a random number using rand() inside the array
->using other variables, check if there is the value generated is already assigned to some other slot
-> if not, assign thee vaue to the slot
here's quote of my code-
Code:
for ( i=0; i<4; i++)
{
for( j=0; j<4; j++)
{
z=(rand()%15)+1;
for ( k=0; k<4; k++)
{
for( l=0; l<4; l++)
{
if (a[k][l]==z)
break;
}
}
}
}
please suggest necessary changes.
Thank you