Sunday , December 11 2016
Home / C / Program to check Upper Triangular matrix

Program to check Upper Triangular matrix

What is Upper Triangular Matrix?  An upper triangular matrix is a square matrix in which all the elements below the diagonal are zero. We consider a Matrix U with ‘i’ rows and ‘j’ columns, then mathematically we represent the upper triangular matrix as
upper triangular matrix formula

In another word strictly upper triangular matrix is an upper triangular matrix having 0’s along the diagonal as well, i.e., U(ij)=0 for i>=j.

UpperTriangularMatrix

 

  • Program in C

     

     Output:

    Output 1:

    Enter the order of matrix:3
    Enter your inputs:
    1  2 3
    0  4 5
    0  0 9
    Given matrix is an upper triangular matrix

     

    Output 2:

    Enter the order of matrix:3
    Enter your inputs:
    1  2 3
    0  4 5
    7  0 9
    Not an upper triangular matrix

  • Program in java
     Output:

    Enter the order of the matrix : 4
    Enter an element : 1
    Enter an element : 2
    Enter an element : 3
    Enter an element : 4
    Enter an element : 0
    Enter an element : 6
    Enter an element : 7
    Enter an element : 8
    Enter an element : 0
    Enter an element : 0
    Enter an element : 2
    Enter an element : 3
    Enter an element : 0
    Enter an element : 0
    Enter an element : 0
    Enter an element : 7
    _____________________
    The Matrix is :
    1 2 3 4
    0 6 7 8
    0 0 2 3
    0 0 0 7
    _____________________
    The matrix is an Upper Triangular Matrix

 

Also See:   c program for Snooker Animation in C language

Check Also

Hide Mouse Pointer C Program

How to Hide a Mouse Pointer Program in C : This program will show and hide ...

Leave a Reply

Your email address will not be published. Required fields are marked *

Preventing spam * Time limit is exhausted. Please reload the CAPTCHA.