Java Program:

- To print full triangle pattern using alphabet

Example:

User Input: 3

Output:

    A
  A B A
A B C B A
import java.util.Scanner;

public class Pattern {

  public static void main(String[] args) {
    Scanner userInput = new Scanner(System.in);
    System.out.print("Enter number of rows : ");

    int rows;
    char c;
    rows=userInput.nextInt();
    for(int i=rows; i>=1; i--) {
      c='A';
      for(int j=1; j<=(2*rows-i); j++) {
        if(j<i)System.out.print("  ");
        else {
          if(j<rows)System.out.print(c++ +" ");
          else System.out.print(c-- +" ");
        }
      }
      System.out.print("\n");
    }

  }
}

Output:

Enter number of rows: 4

      A
    A B A
  A B C B A
A B C D C B A
Program
pattern

Main Logic :

for(int i=rows; i>=1; i--) {
  c='A;
  for(int j=1; j<=(2*rows-i); j++) {
    if(j<i)System.out.print("  ");
    else {
      if(j<rows)System.out.print(c++ +" ");
      else System.out.print(c-- +" ");
    }
  }
   System.out.print("\n");
}

You can print the same pattern in small alphabets, just set c='a'

Concept

Coming Soon !

Quick
Tutorial

Quote

A good decision is based on knowledge and not on numbers.