Java Program to display the lower triangular matrix17 Mar 2025 | 2 min read In this program, we need to display the lower triangular matrix. Lower Triangular MatrixLower triangular matrix is a square matrix in which all the elements above the principle diagonal will be zero. To find the lower triangular matrix, a matrix needs to be a square matrix that is, the number of rows and columns in the matrix need to be equal. Dimensions of a typical square matrix can be represented by n x n. ![]() Consider the above example, principle diagonal element of given matrix is (1, 6, 6). All the elements above the diagonal needs to made zero. In our example, those elements are at positions (1, 2), (1, 3) and (2, 3). To convert given matrix into the lower triangular matrix, loop through the matrix and set the values of the element to zero where column number is greater than row number. Algorithm
ProgramOutput: Lower triangular matrix: 1 0 0 8 6 0 4 5 6 Next TopicJava Programs |
Program to print the elements of an array present on odd position In this program, we need to print the elements of the array which are present in odd positions. This can be accomplished by looping through the array and printing the elements of an array...
1 min read
The spiral pattern (or matrix in spiral form) is frequently asked in Java interviews and academics. In this section, we will create a Java program to create a spiral pattern or spiral matrix. What is Spiral Matrix or Spiral Pattern? A spiral pattern is a number pattern...
7 min read
: The factorial of a non-negative integer n is the product of all positive integers less than or equal to n. The formula for calculating the factorial of a number n is: n! = n * (n-1) * (n-2) * ... * 2 * 1 Factorial of...
6 min read
It is a problem frequently asked in interviews of top IT companies like Google, Amazon, TCS, Accenture, etc. By solving the problem, one wants to check the logical ability, critical thinking, and problem-solving skill of the interviewee. So, in this section, we are going to discuss...
5 min read
In this program, we need to check whether the given matrix is a sparse matrix. A matrix is said to be sparse matrix if most of the elements of that matrix are 0. It implies that it contains very less non-zero elements. To check whether the given...
3 min read
Insertion sort is a simple sorting algorithm that puts together the final sorted array element by element. It loops through an array and extracts one component from the beginning data to insert it into the right place at the already sorted section of the array....
7 min read
In this program, we need to find out the total number of binary search trees can be constructed with n values. Below diagram shows a possible binary search tree with the key value as 3. So, we can construct a total of five binary search...
3 min read
In this section, we will learn what is an autobiographical number and also create Java programs to check if the given number is autobiographical or not. The autobiographical number program frequently asked in Java coding tests to check the logic of the programmer. Autobiographical Number A digit count...
4 min read
In this section, we will create a Java program to display even numbers from 1 to 100. To learn the Java even number program, you must have the basic knowledge of Java for loop and if statement. We can use different ways to display even numbers: Using Java...
3 min read
Java program to print the following pattern on the console A B B C C C D D D D E E E E E To accomplish this task, we need to use two loops, the first loop is responsible for printing the line breaks whereas the second loop is responsible...
1 min read
We request you to subscribe our newsletter for upcoming updates.
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India