Lesson 56 2D Arrays - Part 5 - Square Matrix Programs

Опубликовано: 01 Январь 1970
на канале: JavaJourneyWithMadhavi
21
3

In this video, accessing and displaying main diagonal elements and secondary diagonal elements of a square matrix is explained with the help two programs in the Java Environment. Accessing upper triangular matrix and lower triangular matrix is explained.

Link to the Book - Essentials of Computer Applications:

https://www.amazon.in/Essentials-Comp...

Practice Exercise - Square matrix :

a) Upper triangular square matrix where all the elements below the main diagonal are zero. For example,
1 2 3
0 4 5
0 0 6
1. Write a program to initialize the above array and print the elements of upper triangular matrix.
b) Lower triangular square matrix where all the elements above the main diagonal are zero. For example,
1 0 0
2 3 0
4 5 6
2. Write a program to initialize the above array and print the elements of lower triangular matrix.
c) Diagonal square matrix where the entries outside the principal diagonal are all zero. For example,
1 0 0
0 2 0
0 0 6

3. Write a program to read a 3x3 square matrix and check whether it is a diagonal square matrix or not.
4. Read a 4x 4 square matrix and print sum of left diagonal elements and sum of right diagonal elements along with the matrix.