Please, help me with the following question:
Write a complete C-language program that declares a square-sized array 5x5. Then, your program must populate this array randomly with 0s and 1s (the array should be different for each program run). Finally, your program should inform how many rows and null columns the array has. Here is an example of program output. In that program does not provide input data. Matrix generated:
1 1 0 1 0
0 0 0 0 0
0 1 0 0 0
1 0 0 1 0
1 1 0 1 0
A matriz possui 1 linha e 2 colunas nulas!
The code that I can not read the rows and null columns:
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main(int argc, char**argv){
int matriz[5][5];
int linha, coluna, x, count_linha, count_coluna;
srand(time(NULL));
printf("Matriz Gerada: \n");
for(linha=0; linha<5; linha++){
printf("\n");
for(coluna=0; coluna<5; coluna++){
x= rand() %2 + 0;
printf("%3d",x);
matriz[linha][coluna];
if(linha==0){
count_linha++;
}
if(coluna==0){
count_coluna++;
}
}
}
printf("\n");
printf("A matriz tem %d linhas nulas, e %d colunas nulas",count_linha, count_coluna);
}