We can print the following Pattern 1) * * * * * //print * * * * * * * * * * * * * * * * * * * * * 2) 1 1 1 1 1 //print i 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 3) 1 2 3 4 5 //print j 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 4) A A A A A //(char)(i+64) B B B B B C C C C C D D D D D E E E E E 5) A B C D E //(char)(j+64) A B C D E A B C D E A B C D E A B C D E package demo; import java.util.Scanner; public class Pattern5 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("Enter the number"); int n=sc.nextInt(); for(int i=1;i<=n;i++) { for(int j=1;j<=n;j++ ) { //System.out.print("* "); //System.out.print(i+ "5 "); //System.out.print(j+ " "); //System.out.print((char)(i+64)+ " "); System.out.print((char)(j+64)+ " "); } System.out.println(); } } } O/P:- Enter the number 5 A B C D E A B C D E A B C D E A B C D E A B C D E