#include<stdio.h>
#include<conio.h>
void main()
{
int a[3][3];
int i,j,s=0,k;
printf("\n Enter the elements of the matrix=\n");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{ printf("a[%d][%d]=",i,j);
scanf("%d",&a[i][j]);
}
}
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
printf("\t%d",a[i][j]);
}
printf("\n");
}
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{ if(a[i][j]==0)
s++;
}
}
k=9;
printf("\n The total number of 0 is %d",s);
if(s>k/2)
printf("\nThe matrix is sparce matrix ");
else
printf("\n The matrix is not sparce matrix");
getch();
}
NEXT INPUT
#include<conio.h>
void main()
{
int a[3][3];
int i,j,s=0,k;
printf("\n Enter the elements of the matrix=\n");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{ printf("a[%d][%d]=",i,j);
scanf("%d",&a[i][j]);
}
}
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
printf("\t%d",a[i][j]);
}
printf("\n");
}
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{ if(a[i][j]==0)
s++;
}
}
k=9;
printf("\n The total number of 0 is %d",s);
if(s>k/2)
printf("\nThe matrix is sparce matrix ");
else
printf("\n The matrix is not sparce matrix");
getch();
}
NEXT INPUT
No comments:
Post a Comment