/* Write A C Program To Accept A Matric And

  • June 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View /* Write A C Program To Accept A Matric And as PDF for free.

More details

  • Words: 187
  • Pages: 1
/* Write a C program to accept a matric and determine whether * it is a sparse matrix. A sparse martix is matrix which * has more zero elements than nonzero elements #include <stdio.h> void main () { static int m1[10][10]; int i,j,m,n; int counter=0; printf ("Enter the order of the matix\n"); scanf ("%d %d",&m,&n); printf ("Enter the co-efficients of the matix\n"); for (i=0;i<m;++i) { for (j=0;j((m*n)/2)) { printf ("The given matrix is sparse matrix \n"); } else printf ("The given matrix is not a sparse matrix \n"); printf ("There are %d number of zeros",counter); } /* EN dof main() */ /*---------------------------------------------Output Enter the order of the matix 2 2 Enter the co-efficients of the matix 1 2 3 4 The given matrix is not a sparse matrix There are 0 number of zeros Run 2 Enter the 3 3 Enter the 1 0 0 0 0 1 0 1 0 The given There are

order of the matix co-efficients of the matix

matrix is sparse matrix 6 number of zeros

-----------------------------------------------*/

* * */

Related Documents