0
Make a program that randomly generates 20 integers in the range of 0 to 999 and fill in a matrix of size 5 x 4. Show the matrix, then show the transposed matrix (reverse row with column).
I’ve managed to fill the matrix with random numbers only I can’t transpose.
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main()
{
int i, j, matriz[5][4], matriz5[4][5];
srand(time(NULL));
for (i = 0; i < 5; i++)
for(j = 0; j < 4; j++)
matriz[i][j] = rand()%999;
for (i = 0; i < 5; i++){
for(j = 0; j < 4; j++){
printf(" %d ",matriz[i][j]);
}
printf("\n");
}
return 0;
}