forked from swaaz/basicprograms
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprogram.c
More file actions
36 lines (29 loc) · 654 Bytes
/
Copy pathprogram.c
File metadata and controls
36 lines (29 loc) · 654 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/* To determine whether the matrix is a triangular matrix.
First, you will be given N, which is the size of the matrix.
Then you will be given N rows of integers, where each row consists of
N integers separated by spaces.
If the input matrix is triangular, then print yes. Otherwise, print
no. */
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a[10][10],n,i,j,flag=0;
scanf("%d",&n);
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{scanf("%d",&a[i][j]);
}
}
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
if(!(i==j) &&(i>j || j>i) ) flag=1;
}
}
if(!(flag))printf("no\n");
else printf("yes");
return 0;
}