write a c programme to check sparse matrix

Ekan e vul kothai hocce output dekacce nah kno
mail@pastecode.io avatar
unknown
c_cpp
7 months ago
602 B
6
Indexable
Never
#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;
}
Leave a Comment