write a c programme to check sparse matrix

Ekan e vul kothai hocce output dekacce nah kno
 avatar
unknown
c_cpp
2 years ago
602 B
9
Indexable
#include<stdio.h>

#define size 100
int main()
{
    int a[size][size];
    int row, col;
   // scanf("%d%d", &row,&col);
    int count = 0;

    for(row = 0; row < size; row++){
        for(col = 0; col < size; col++){
            scanf("%d",&a[row][col]);
        }
    }


     for(row = 0; row < size; row++){
        for(col = 0; col < size; col++){

            if(a[row][col] == 0){
               count++;

            }
        }
    }

    if(count >= ((row * col)/ 2)) {
        printf("YES\n");
    }
    else{
        printf("NO\n");
    }

  return 0;
}
Editor is loading...
Leave a Comment