MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / main

Function main

Matrix/sparseMatrix.c:32–64  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30}
31
32int 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}

Callers

nothing calls this directly

Calls 1

sparseMatrixFunction · 0.85

Tested by

no test coverage detected