Javatpoint Logo
Javatpoint Logo

Java Program to Print Matrix in Z Form

In this section, we will discuss how to print the matrix in Z form. Also, we will create a Java program that prints the all the Z elements of the matrix.

The Z form includes the elements of the first row, right diagonal, and the last row of the matrix. To print the Z form of the matrix, the rows and columns must be the same.

Java Program to Print Matrix in Z Form

MatrixZForm.java

Output:

Java Program to Print Matrix in Z Form

In the following program, we have printed the elements of the matrix in an array that forms a Z pattern.

MatrixZElements.java

Output:

Z elements of the matrix are: 
11 23 9 34 67 38 71 91 56 88    






Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA