Java Program to Print Right Triangle of Consecutive Alphabets Pattern

Write a Java program to print right triangle of consecutive alphabets pattern using for loop.

package Alphabets;
import java.util.Scanner;

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

This Java program prints the right angled triangle pattern of consecutive alphabets using while loop. For more Alphabet examples, refer to the Java Alphabet Pattern Programs article.

package Alphabets;

import java.util.Scanner;

public class RightTriConsecAlp2 {
	
	private static Scanner sc;
	
	public static void main(String[] args) {
		
		sc = new Scanner(System.in);	
		
		System.out.print("Enter Right Triangle of Consecutive Alphabets Rows = ");
		int rows = sc.nextInt();
		
		System.out.println("Right Triangle of Consecutive Alphabets Pattern");
		int alphabet = 65;
		
		int j, i = 0; 
		
		while(i <= rows - 1) 
		{
			j = 0;
			
			while(j <= i ) 	
			{
				System.out.print((char)(alphabet++) + " ");
				j++;
			}
			System.out.println();
			i++;
		}
	}
}
Enter Right Triangle of Consecutive Alphabets Rows = 8
Right Triangle of Consecutive Alphabets Pattern
A 
B C 
D E F 
G H I J 
K L M N O 
P Q R S T U 
V W X Y Z [ \ 
] ^ _ ` a b c d 

This Java example uses the Java do while loop to display the right angled triangle pattern of consecutive column alphabets.

package Alphabets;

import java.util.Scanner;

public class RightTriConsecAlp3 {
	
	private static Scanner sc;
	
	public static void main(String[] args) {
		
		sc = new Scanner(System.in);	
		
		System.out.print("Enter Right Triangle of Consecutive Alphabets Rows = ");
		int rows = sc.nextInt();
		
		System.out.println("Right Triangle of Consecutive Alphabets Pattern");
		int alphabet = 65;
		
		int j, i = 0; 
		
		do
		{
			j = 0;
			
			do 	
			{
				System.out.print((char)(alphabet++) + " ");

			} while(++j <= i );
			
			System.out.println();

		} while(++i <= rows - 1);
	}
}
Enter Right Triangle of Consecutive Alphabets Rows = 9
Right Triangle of Consecutive Alphabets Pattern
A 
B C 
D E F 
G H I J 
K L M N O 
P Q R S T U 
V W X Y Z [ \ 
] ^ _ ` a b c d 
e f g h i j k l m 

Also Read