Floyd's triangle

Java program to display triangle alphabet pattern

Java program to display triangle alphabet pattern

In this tutorial, we will discuss a concept of Java program to display triangle alphabet pattern using for loop in java language.

here, we displayed 15 alphabet Floyd’s triangle program with coding and using nested for loop and also we get input from user using Java scanner.

user can provide numbers as they wish and get the alphabet pattern according their input

Java program to display triangle alphabet pattern

Pattern programs

Floyd’s Triangle Alphabet Pattern 1

Program 1

import java.util.Scanner;
class AlphabetPatternOne{
public static void main (String args[]){
int i,j;
Scanner scan=new Scanner(System.in);
System.out.print("Enter the number of rows: ");
int rows=scan.nextInt();
for(i=1; i<=rows; i++){
  for(j=1; j<=i; j++){
  System.out.print((char)(i+64));


}
System.out.println();

}

}

}

When the above code is compiled and executed, it produces the following results

Enter the number of rows: 6
A
BB
CCC
DDDD
EEEEE
FFFFFF

 

Floyd’s Triangle Alphabet Pattern 2

Program 2

import java.util.Scanner;
class AlphabetPatternTwo{
public static void main (String args[]){
int i,j;
int letter=64;
Scanner scan=new Scanner(System.in);
System.out.print("Enter the number of rows");
int rows=scan.nextInt();
for(i=1; i<=rows; i++){
  for(j=1; j<=i; j++){
  System.out.print((char)(j+letter));


}
System.out.println();

}

}

}

When the above code is compiled and executed, it produces the following results

Enter number of rows: 6
A
AB
ABC
ABCD
ABCDE
ABCDEF

 

Floyd’s Triangle Alphabet Pattern 3

Program 3

import java.util.Scanner;
class AlphabetPatternThree{
public static void main (String args[]){
int i,j;
int letter=64;
Scanner scan=new Scanner(System.in);
System.out.print("Enter the number of rows: ");

int rows=scan.nextInt();
System.out.print("\nYour pattern here\n\n");
for(i=rows; i>=1; i--){
  for(j=rows; j>=i; j--){
  System.out.print((char)(j+letter));
}

System.out.println();
}
}
}

When the above code is compiled and executed, it produces the following results

Enter the number of rows: 6

Your pattern here

F
FE
FED
FEDC
FEDCB
FEDCBA

 

Floyd’s Triangle Alphabet Pattern 4

Program 4

import java.util.Scanner;
class AlphabetPatternFour{
public static void main (String args[]){
int i,j;
int letter=64;
Scanner scan=new Scanner(System.in);
System.out.print("Enter the number of rows: ");

int rows=scan.nextInt();
System.out.print("\nYour pattern here\n\n");
for(i=rows; i>=1; i--){
  for(j=1; j<=i; j++){
  System.out.print((char)(j+letter));
}

System.out.println();
}
}
}

When the above code is compiled and executed, it produces the following results

Enter your number of rows: 6

Your pattern here

ABCDEF
ABCDE
ABCD
ABC
AB
A

 

Floyd’s Triangle Alphabet Pattern 5

Program 5

import java.util.Scanner;
class AlphabetPatternFive{
public static void main (String args[]){
int i,j;
int letter=64;
Scanner scan=new Scanner(System.in);
System.out.print("Enter the number of rows: ");

int rows=scan.nextInt();
System.out.print("\nYour pattern here\n\n");
for(i=1; i<=rows; i++){
  for(j=rows; j>=i; j--){
  System.out.print((char)(j+letter));
}

System.out.println();
}
}
}

When the above code is compiled and executed, it produces the following results

Enter the number of rows: 6

Your pattern here

FEDCBA
FEDCB
FEDC
FED
FE
F

 

Floyd’s Triangle Alphabet Pattern 6

Program 6

import java.util.Scanner;
class AlphabetPatternSix{
public static void main (String args[]){
int i,j;
int letter=64;
Scanner scan=new Scanner(System.in);
System.out.print("Enter the number of rows: ");

int rows=scan.nextInt();
System.out.print("\nYour pattern here\n\n");
for(i=1; i<=rows; i++){
  for(j=rows; j>=i; j--){
  System.out.print((char)(i+letter));
}

System.out.println();
}
}
}

When the above code is compiled and executed, it produces the following results

Enter the number of rows:6

Your pattern here

AAAAAA
BBBBB
CCCC
DDD
EE
F

 

Floyd’s Triangle Alphabet Pattern 7

Program 7

import java.util.Scanner;
class AlphabetPatternSeven{
public static void main (String args[]){
int i,j;
int letter=64;
Scanner scan=new Scanner(System.in);
System.out.print("Enter the number of rows: ");

int rows=scan.nextInt();
System.out.print("\nYour pattern here\n\n");
for(i=rows; i>=1; i--){
  for(j=i; j<=rows; j++){
  System.out.print((char)(j+letter));
}

System.out.println();
}
}
}

When the above code is compiled and executed, it produces the following results

Enter the number of rows: 6

Your pattern here

F
EF
DEF
CDEF
BCDEF
ABCDEF

 

Floyd’s Triangle Alphabet Pattern 8

Program 8

import java.util.Scanner;
class AlphabetPatternEight{
public static void main (String args[]){
int i,j;
int letter=64;
Scanner scan=new Scanner(System.in);
System.out.print("Enter the number of rows: ");

int rows=scan.nextInt();
System.out.print("\nYour pattern here\n\n");
for(i=1; i<=rows; i++){
  for(j=i; j>=1; j--){
  System.out.print((char)(j+letter));
}

System.out.println();
}
}
}

When the above code is compiled and executed, it produces the following results

Enter the number of rows: 6

Your pattern here

A
BA
CBA
DCBA
EDCBA
FEDCBA

 

Floyd’s Triangle Alphabet Pattern 9

Program 9

import java.util.Scanner;
class AlphabetPatternNine{
public static void main (String args[]){
int i,j;
int letter=64;
Scanner scan=new Scanner(System.in);
System.out.print("Enter the number of rows: ");

int rows=scan.nextInt();
System.out.print("\nYour pattern here\n\n");
for(i=1; i<=rows; i++){
  for(j=1; j<=i; j++){
  System.out.print((char)(rows-i+1+letter));
}

System.out.println();
}
}
}

When the above code is compiled and executed, it produces the following results

Enter the number of rows: 6

Your pattern here

F
EE
DDD
CCCC
BBBBB
AAAAAA

 

Floyd’s Triangle Alphabet Pattern 10

Program 10

import java.util.Scanner;
class AlphabetPatternTen{
public static void main (String args[]){
int i,j;
int letter=64;
Scanner scan=new Scanner(System.in);
System.out.print("Enter the number of rows: ");

int rows=scan.nextInt();
System.out.print("\nYour pattern here\n\n");
for(i=rows; i>=1; i--){
  for(j=1; j<=i; j++){
  System.out.print((char)(i+letter));
}

System.out.println();
}
}
}

When the above code is compiled and executed, it produces the following results

Enter the number of rows: 6

Your pattern here

FFFFFF
EEEEE
DDDD
CCC
BB
A

 

Floyd’s Triangle Alphabet Pattern 11

Program 11

import java.util.Scanner;
class AlphabetPatternEleven{
public static void main (String args[]){
int i,j;
int letter=64;
Scanner scan=new Scanner(System.in);
System.out.print("Enter the number of rows: ");

int rows=scan.nextInt();
System.out.print("\nYour pattern here\n\n");
for(i=rows; i>=1; i--){
  for(j=i; j>=1; j--){
  System.out.print((char)(j+letter));
}

System.out.println();
}
}
}

When the above code is compiled and executed, it produces the following results

Enter the number of rows

Your pattern here

FEDCBA
EDCBA
DCBA
CBA
BA
A

 

Floyd’s Triangle Alphabet Pattern 12

Program 12

import java.util.Scanner;
class AlphabetPatternTwelve{
public static void main (String args[]){
int i,j,k=1;
int letter=64;
Scanner scan=new Scanner(System.in);
System.out.print("Enter the number of rows: ");

int rows=scan.nextInt();
System.out.print("\nYour pattern here\n\n");
for(i=1; i<=rows; i++){
  for(j=1; j<=i; j++,k++){
  System.out.print((char)(k+letter));
}

System.out.println();
}
}
}

When the above code is compiled and executed, it produces the following results

Enter the number of rows:6

Your pattern here

A
BC
DEF
GHIJ
KLMNO
PQRSTU

 

Floyd’s Triangle Alphabet Pattern 13

Program 13

import java.util.Scanner;
class AlphabetPatternThirteen{
public static void main (String args[]){
int i,j,k=1;
int letter=64;
int num,count;
Scanner scan=new Scanner(System.in);
System.out.print("Enter the number of rows: ");

int rows=scan.nextInt();
System.out.print("\nYour pattern here\n\n");
for(i=1; i<=rows; i++){
    num=rows-1;
    count=i;
  for(j=1; j<=i; j++){
  System.out.print((char)(count+letter));
  count=count+num;
  num--;
}

System.out.println();
}
}
}

When the above code is compiled and executed, it produces the following results

Enter the number of rows: 6

Your pattern here

A
BG
CHL
DIMP
EJNQS
FKORTU

 

Floyd’s Triangle Alphabet Pattern 14

Program 14

import java.util.Scanner;
class AlphabetPatternFourteen{
public static void main (String args[]){
int i,j,k;
int letter=64;
Scanner scan=new Scanner(System.in);
System.out.print("Enter the number of rows: ");

int rows=scan.nextInt();
System.out.print("\nYour pattern here\n\n");
for(i=rows; i>=1; i--){
    k=i;
  for(j=1; j<=i; j++,k++){
  System.out.print((char)(k+letter));
 
}

System.out.println();
}
}
}

When the above code is compiled and executed, it produces the following results

Enter the number of rows: 6

Your pattern here

FGHIJK
EFGHI
DEFG
CDE
BC
A

 

Floyd’s Triangle Alphabet Pattern 15

Program 15

import java.util.Scanner;
class AlphabetPatternFifteen{
public static void main (String args[]){
int i,j;
int letter=64;
Scanner scan=new Scanner(System.in);
System.out.print("Enter the number of rows: ");

int rows=scan.nextInt();
System.out.print("\nYour pattern here\n\n");
for(i=1; i<=rows; i++){
  for(j=i; j<=rows; j++){
  System.out.print((char)(j+letter));
 
}

System.out.println();
}
}
}

When the above code is compiled and executed, it produces the following results

Enter the number of rows: 6

your pattern here

ABCDEF
BCDEF
CDEF
DEF
EF
F

 

Suggested for you

For loop in Java language

Nested for loop in Java language

Operator in Java language

Data type and variable in Java language

Class and main method  in Java language

C program to display alphabet pattern
Cpp program to print triangle alphabet pattern
Karmehavannan

I am Mr S.Karmehavannan. Founder and CEO of this website. This website specially designed for the programming learners and very especially programming beginners, this website will gradually lead the learners to develop their programming skill.

Recent Posts

PHP Star Triangle pattern program

PHP Star Triangle pattern program In this tutorial, we will discuss about PHP Star Triangle…

1 month ago

PHP Full Pyramid pattern program

PHP Full Pyramid pattern program In this tutorial, we will discuss about PHP Full Pyramid…

2 months ago

5 methods to add two numbers in Java

5 methods to add two numbers in Java In this tutorial, we will discuss the…

2 months ago

Python Full Pyramid star pattern program

Python full Pyramid star pattern program In this tutorial, we will discuss  the concept of…

5 months ago

Write a function or method to convert C into F -Entered by user

Write a function or method to convert C into F -Entered by the user In…

10 months ago

How to write a function or method to convert Celsius into Fahrenheit

How to write a function or method to convert Celsius into Fahrenheit In this tutorial,…

10 months ago