Ver Mensaje Individual
  #10 (permalink)  
Antiguo 11/08/2009, 09:24
god2710
 
Fecha de Ingreso: agosto-2009
Mensajes: 18
Antigüedad: 14 años, 8 meses
Puntos: 0
Respuesta: Problema con Matriz y Random

Por si aun no consigues lo que buscabas tratare yo..

#include <stdio.h>

#define fila 4
#define col 4
#define num_elementos 15

int main()
{
int i,j;
int mat[fila][col] = {0};
for (i=0; i<fila; i++) {
for (j=0; j<col; j++) {
if (mat[i][j] != mat[0][0]) {
mat[i][j] = rand() & num_elementos + 1;
}
}
}
for (i=0; i<fila; i++) {
for (j=0; j<col; j++) {
printf ("%d ", mat[i][j]);
}
printf ("\n");
}
}