/*To check if a given matrix is upper triangular or not*/

#include<stdio.h>
#include<conio.h>
void main()
{
 int i,j,p=0,m,n,a[10][10];
 clrscr();
 printf("Enter the order of the matrix: ");
 scanf("%d%d", &n, &m);
 printf("Enter the elements of the matrix:\n");
 for(i=0;i<n;i++)
 for(j=0;j<m;j++)
 scanf("%d", &a[i][j]);
 for(i=0;i<n;i++)
 {
   for(j=0;j<m;j++)
   {
     if(i<j)
     if(a[i][j]!=0)
     p=1;
   }
 }
 if(p==0)
 printf("The given matrix is an upper triangular matrix");
 else
 printf("The given matrix is not an upper triangular matrix");
 getch();
}
