In this program I only input the number of columns and the entries of the matrix. The program then determines the number of rows. The program works perfectly for the correct number of entries like 4 entries for a 2 by 2 matrix. However it doesnt work for 3 entries for a 2 by 2 matrix. Please reply fast

Code:Code:#include<stdio.h> #include<stdlib.h> int main() { int m,x, n, c = 0, d,k, matrix[10][10], transpose[10][10], product[10][10]; printf("Enter the number of columns of matrix "); scanf("%d",&m); if(m<=0){ printf("You entered a invalid value."); exit(0); } else{ printf("Enter the elements of matrix \n"); for( c = 0 ; c < 10 ; c++ ) { for( d = 0 ; d < m ; d++ ) { scanf("%d",&matrix[c][d]); if (matrix[c][d] == 99) // 99 is variable I declared to use as a break break; } if (matrix[c][d] == 99) break; } } printf("\nHere is your matrix:\n"); int i; for(i=0;i<c;i++) { for(d=0;d<m;d++) { printf("%3d ",matrix[i][d]); } printf("\n"); }