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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
C# inverted full pyramid star pattern In this article, we will discuss the concept of…
C# Full Pyramid star pattern program In this article, we will discuss the concept of…
Program to count vowels, consonants, words, characters and space in Java In this article, we…
How to print multiplication table using Array in C++ language In this post, we will…
C Program to multiplication table using Array In this tutorial , we will discuss about…
Java program to check odd or even using recursion In this tutorial, we discuss a…