C Program for CREATE MATRICES
#include stdio.h>
#include conio.h>
void main()
{
int a[10][10],rw=0,clm=0,i=0,j=0;
char s=' ';
clrscr();
for(i=0;i<10;i++)
{
for(j=0;j<10;j++)
{
a[i][j]=0;
}
}
i=0; j=0;
printf("\nENTER THE LIMIT OF ROWS: ");
scanf("%d",&rw);
printf("\nENTER THE LIMIT OF COLS: ");
scanf("%d",&clm);
for(i=0;i
{
for(j=0;j
{
printf("\nENTER THE ELEMENT: ");
scanf("%d",&a[i][j]);
}
}
for(i=0;i
{
for(j=0;j
{
if(a[i][j]==0)
{
a[i][j]='-';
printf("%c ",a[i][j]);
}
else
{
printf("%d ",a[i][j]);
}
}
printf("\n");
}
getch();
}
OUTPUT :
ENTER THE LIMIT OF ROWS : 2
ENTER THE LIMIT OF COLS : 2
ENTER THE ELEMENT 1
ENTER THE ELEMENT 2
ENTER THE ELEMENT 3
ENTER THE ELEMENT 4
1 2
3 4