Explore
ProGrad Programs
About Us

Edit
Reply




Edit

Program to find if the given matrix is upper triangular or not | FACE Prep

Published on 11 Mar 2020

Program to find if the given matrix is upper triangular or not is discussed here. A square matrix is obtained as input from the user and it is checked if it is upper triangular or not. A square matrix is said to be an upper triangular matrix if all the entries below the diagonal are zero.

upper triangular matrix or not

Algorithm to check if the given matrix is upper triangular or not


  • Input the order of the square matrix.
  • Input the matrix elements.
  • Repeat from i = 1 to n.
  • Repeat from j = 0 to i.
  • if (mat[i][j] != 0)
  • Set flag = 0 and print "Not An Upper Triangular Matrix".
  • Else, print "Upper Triangular Matrix".


Program to check if the given matrix is upper triangular or not


C
C++
Java
Python 3

Output
Input the matrix elements :
1 2 3
0 1 2
0 0 3
Upper triangular matrix


Recommended Programs







If you have any feedback about this article and want to improve this, please write to enquiry@faceprep.in
Explore 'c'
Articles