Desired output-
these are the separate codes for D and M,now how to combine them to get the desired output,pls help*** * * * * * * * * * * * * * * * * * *** * *
CODE FOR M class a { public static void main(String args[]) { int i,j; for(i=1;i<=5;i++) { for(j=1;j<=5;j++) { if(j==1 || j==5) System.out.print("*"); else if(i==2 && (j==2 || j==4)) System.out.print("*"); else if(i==3 && j==3) System.out.print("*"); else System.out.print(" "); } System.out.println(); } } } CODE FOR D class a { public static void main(String args[]) { int i,j; for(i=1;i<=5;i++) { for(j=1;j<=4;j++) { if(j==1) System.out.print("*"); else if((j==2 || j==3)&& i==1) System.out.print("*"); else if((i==2 || i==3 ||i==4) && j==4) System.out.print("*"); else if((j==2 || j==3)&& i==5) System.out.print("*"); else System.out.print(" "); } System.out.println(); } } }