JAVA program for character/alphabet pattern 12

JAVA program for character/alphabet pattern 12

This program is to print a character/alphabet pattern 12 in JAVA.

E
D E
C D E
B C D E
A B C D E

If you need a dry run of the program or any other query, then kindly leave a comment in the comment box or mail me, I would be more than happy to help you.

Program

import java.util.*;
 
class ap12
{
	public static void main(String args[])
	{
		int i,j,n;
 		Scanner sc = new Scanner(System.in);
    		System.out.println("Enter the no of lines");
 		n=sc.nextInt();
    		for(i=n;i>=1;i--)
    		{
        		for(j=i;j<=n;j++)
        		{ 		
            			System.out.print((char)(j+64));
        		} 
        		System.out.println("");
    		}
	}
}

Output

Share Me!