Advertisement
Guest User

Untitled

a guest
Mar 27th, 2017
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. #include<stdio.h>
  2. #define N 5
  3. #define M 6
  4. void main (void)
  5. {
  6. int matrix[N][M],i,j,count=0,not_zero=0;
  7.  
  8. for(i=0;i<N;i++)
  9. for(j=0;j<M;j++)
  10. {
  11. printf("Please enter your Matrix:");
  12. scanf("%d",&matrix[i][j]);
  13. }
  14.  
  15. for(i=0;i<N;i++)
  16. for(j=0;j<M;j++)
  17. if(matrix[i][j] != 0)
  18. count++;
  19.  
  20. not_zero=count/(N*M);
  21.  
  22. if(not_zero > 0.1 || count < 2)
  23. printf("NO");
  24. else
  25. printf("YES");
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement