Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
352 B
0
Indexable
Never
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,a[3][3];
clrscr();
for(i=0;i<3;i++)
{
 for(j=0;j<3;j++)
 {
if(i==j)
a[i][j]=0;
else if(i>j)
a[i][j]=1;
else
a[i][j]=-1;
 }
}
printf("\nthe upper triangle and lower triangle is::\n");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
printf("%4d",a[i][j]);
printf("\n");
}
getch();
}