Рет қаралды 2,927
We have to print a given matrix of size nxn, and we have to print the matrix in a zig-zag form.
Let's see how we can do it.
First of all, we all know how to print all the elements of a matrix. We have to use two loops to print the entire 2-dimensional array.
Now for printing the matrix in a zig-zag manner, even rows will be printed the same as before but for odd rows, we have to print it in a reverse manner.
Let's see how we can write code for the same in java and print the 2D array in a zig-zag manner.
Subscribe @TAPACADEMY
For more information, fill out this form: forms.gle/8eiUmM92Fx563Aen9
or call us at 8884881203
Facebook: / thetapacademy
Instagram: / tapacademy_online
Linkedin: / 73820805
Website: www.thetapacademy.com
#java #2darray #arrayjava #dsa #matrix #arrayquestions #arrayprogram