Glyph Print Matrix public class zhiprintmatrix{//Glyph print matrix public static void Printmatrixzigzag (Int[][]matrix) {
Defines two moving directions int tr=0;
int tc=0;
int dr=0;
int dc=0;
int endr=matrix.length-1;
int endc=matrix[0].length-1;
Boolean isup=false;
while (tr!=endr+1) {Printitalicmatrix (matrix,tr,tc,dr,dc,isup);
TR=TC==ENDC?TR+1:TR;
tc=tc==endc?tc:tc+1;
DC=DR==ENDR?DC+1:DC;
dr=dr==endr?dr:dr+1;
Isup=!isup;
} System.out.println (); The data public static void Printitalicmatrix (Int[][]m,int tr,int tc,int dr,int Dc,boolean b) {if (b) is printed on a line diagonally
) {while (tr!=dr+1) {System.out.print (m[tr++][tc--]+ "");
}}else{while (dr!=tr-1) {System.out.print (m[dr--][dc++]+ ""); }} public static void Main (String[]args) {//system.out.println ("Hello world!");
int[][]matrix={{1,2,3,4}, {5,6,7,8}, {9,10,11,12}};
Printmatrixzigzag (matrix); }
}