Java Program to Print Right Arrow Alphabets Pattern

Write a Java program to print right arrow alphabets pattern using for loop.

package Alphabets;

import java.util.Scanner;

public class RightArrowAlps1 {
	
	private static Scanner sc;
	
	public static void main(String[] args) {
		
		sc = new Scanner(System.in);	
		
		System.out.print("Enter Right Arrow Pattern of Alphabets Rows = ");
		int rows = sc.nextInt();
		
		System.out.println("Printing Right Arrow Alphabets Pattern");
		int i, j, k, alphabet = 65;
		
		for (i = 0; i < rows; i++ ) 
		{
			for (j = 0; j < i; j++ ) 
			{
				System.out.print(" ");	
			}
			for (k = i; k < rows; k++ ) 
			{
				System.out.print((char)(alphabet + k) );
			}
			System.out.println();
		}
		
		for (i = rows - 2; i >= 0; i-- ) 
		{
			for (j = 0; j < i; j++ ) 
			{
				System.out.print(" ");
			}
			for (k = i; k <= rows - 1; k++ ) 
			{
				System.out.print((char)(alphabet + k) );
			}
			System.out.println();
		}
	}
}
Java Program to Print Right Arrow Alphabets Pattern

This Java example prints the right arrow pattern of alphabets using while loop.

package Alphabets;

import java.util.Scanner;

public class RightArrowAlps2 {
	
	private static Scanner sc;
	
	public static void main(String[] args) {
		
		sc = new Scanner(System.in);	
		
		System.out.print("Enter Right Arrow Pattern of Alphabets Rows = ");
		int rows = sc.nextInt();
		
		System.out.println("Printing Right Arrow Alphabets Pattern\n");
		int i, j, k, alphabet = 65;
		i = 0;
		
		while(i < rows ) 
		{
			j = 0; 
			while(j < i ) 
			{
				System.out.print(" ");
				j++;
			}
			k = i; 
			while(k < rows ) 
			{
				System.out.print((char)(alphabet + k) );
				k++;
			}
			System.out.println();
			i++;
		}
		
		i = rows - 2;
		while( i >= 0 ) 
		{
			j = 0; 
			while(j < i ) 
			{
				System.out.print(" ");
				j++;
			}
			k = i;
			while( k <= rows - 1 ) 
			{
				System.out.print((char)(alphabet + k) );
				k++;
			}
			System.out.println();
			i--;
		}
	}
}
Enter Right Arrow Pattern of Alphabets Rows = 13
Printing Right Arrow Alphabets Pattern

ABCDEFGHIJKLM
 BCDEFGHIJKLM
  CDEFGHIJKLM
   DEFGHIJKLM
    EFGHIJKLM
     FGHIJKLM
      GHIJKLM
       HIJKLM
        IJKLM
         JKLM
          KLM
           LM
            M
           LM
          KLM
         JKLM
        IJKLM
       HIJKLM
      GHIJKLM
     FGHIJKLM
    EFGHIJKLM
   DEFGHIJKLM
  CDEFGHIJKLM
 BCDEFGHIJKLM
ABCDEFGHIJKLM