#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,mat[10][10],row,col;
printf("Enter the no of row and column :");
scanf("%d%d",&row,&col);
for(i=0;i<row;i++)
{
for(j=0;j<col;j++)
{
if(i==j)
mat[i][j]=0;
else if(i<j)
mat[i][j]=-1;
else
mat[i][j]=1;
}
}
for(i=0;i<row;i++)
{
printf("\n");
for(j=0;j<col;j++)
{
printf("%d\t",mat[i][j]);
}
}
}
OUTPUT :

Wow
ReplyDeletethanks.
Delete