| 30 | } |
| 31 | |
| 32 | int main() |
| 33 | { |
| 34 | int rows,columns,arr[100][100],flag=0; |
| 35 | printf("Enter rows of matrix: "); |
| 36 | scanf("%d",&rows); |
| 37 | printf("\nEnter columns of matrix: "); |
| 38 | scanf("%d",&columns); |
| 39 | printf("\nEnter elements of matrix:\n"); |
| 40 | for(int i=0;i<rows;i++){ |
| 41 | for(int j=0;j<columns;j++){ |
| 42 | scanf("%d",&arr[i][j]); |
| 43 | if(arr[i][j]==0){ |
| 44 | flag++; |
| 45 | } |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | nonZero = (rows*columns)- flag; |
| 50 | if (flag>=nonZero){ |
| 51 | printf("\nSparse Matrix:\n"); |
| 52 | sparseMatrix(arr,rows,columns); |
| 53 | }else{ |
| 54 | printf("\nNot a sparse matrix"); |
| 55 | } |
| 56 | |
| 57 | |
| 58 | |
| 59 | |
| 60 | |
| 61 | |
| 62 | |
| 63 | return 0; |
| 64 | } |
nothing calls this directly
no test coverage detected