#include
#include
void main()
{
int a[10][10],b[10][3],r,c,s=0,i,j;
clrscr();
printf("\nenter the order of the sparse matrix");
scanf("%d%d",&r,&c);
printf("\nenter the elements in the sparse matrix(mostly zeroes)");
for(i=0;i
for(j=0;j
printf("\n%d row and %d column ",i,j);
scanf("%d",&a[i][j]);
if(a[i][j]!=0)
{
b[s][0]=a[i][j];
b[s][1]=i;
b[s][2]=j;
s++;
}
}
}
printf("\nthe sparse matrix is given by");
printf("\n");
for(i=0;i{
for(j=0;j<3;j++)
{
printf("%d ",b[i][j]);
}
printf("\n");
}
getch();
}
Chat with our AI personalities
Write a program in c++ that take input in a integer matrix of size 4*4 and find out if the entered matrix is diagonal or not.
what is the disadvantage of sparse matrix?
Sparse matirx can be represented 1-dimensionally, by creating a array of structures, that have members sumc as: Struct RM{int ROW,int COL, int non_zero}; struct RM SM[Number_non_Zeros +1]; then input row,col for each non-zero element of the sparse matrix. if still unclear please fell free to requestion or query on ikit.bbsr@gmail.com, specifying clearly the question in the subject. Chinmaya N. Padhy (IKIT)
A c program is also known as a computer program. A singular matrix has no inverse. An equation to determine this would be a/c=f. <<>> The determinant of a singular matix is zero.
c program was introduced in the year 1972 by Dennis RitchieNo, it was the C language, not the C program.