sparse matrix

sparse matrix in c
#include<stdio.>
#include<conio.h>
void main()
{
int a[5][5],row,columns,i,j;
printf("Ënter the order of the matrix.(5*5)");scanf("%d%d",&row,&columns);
printf("Enter the element of the matrix\n");
for(i=0;i<row;i++)
for(j=0;j<columns;j++)
{
scanf("%d", &a[i][j]);
}
printf("3-tuple representation");
for(i=0;i<row;i++)

for(j=0;j<column;j++)

{
if(a[i][j]!=0)

{
printf("%d %d %d", (i+1),(j+1),a[i][j]);
}
}
getch();
}

ليست هناك تعليقات:

إرسال تعليق