In this tutorial, we will discuss a concept of Cpp program to print triangle alphabet pattern using for loop in C++ 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 cin function.
the user can provide numbers as they wish and get the alphabet pattern according to their input
Java program to display triangle alphabet pattern
Program 1
#include <iostream> #include <conio.h> using namespace std; int main() { int i,j,rows; cout << "Enter number of rows: "; cin>>rows; cout << "\nHere your pattern\n\n"; for(i=1; i<=rows; i++){ for(j=1; j<=i; j++){ cout<<((char)(i+64)); } cout<< endl; } getch(); return 0; }
When the above code is executed, it produces the following results
Enter number of rows: 6 Here your pattern A BB CCC DDDD EEEEE FFFFFF
Program 2
#include <iostream> #include <conio.h> using namespace std; int main() { int i,j,rows; cout << "Enter number of rows: "; cin>>rows; cout << "\nHere your pattern\n\n"; for(i=1; i<=rows; i++){ for(j=1; j<=i; j++){ cout<<((char)(j+64)); } cout<< endl; } getch(); return 0; }
When the above code is executed, it produces the following results
Enter number of row: 6 Here your pattern A AB ABC ABCD ABCDE ABCDEF
Program 3
#include <iostream> #include <conio.h> using namespace std; int main() { int i,j,rows; cout << "Enter number of rows: "; cin>>rows; cout << "\nHere your pattern\n\n"; for(i=1; i<=rows; i++){ for(j=i; j<=rows; j++){ cout<<((char)(i+64)); } cout<< endl; } getch(); return 0; }
When the above code is executed, it produces the following results
Enter your number of rows: 6 Here your pattern AAAAAA BBBBB CCCC DDD EE F
Program 4
#include <iostream> #include <conio.h> using namespace std; int main() { int i,j,rows; cout << "Enter the number of rows:" << endl; cin>>rows; cout<<"\n"; cout<<"Here, your pattern\n"; for(i=1; i<=rows; i++){ for(j=i; j>=1; j--){ cout<<((char)(j-1+65)); } cout<<"\n"; } getch(); return 0; }
When the above code is executed, it produces the following results
Enter the number of rows: 6 Here, your pattern A BA CBA DCBA EDCBA FEDCBA
Program 5
#include <iostream> #include <conio.h> using namespace std; int main() { int i,j,rows; cout << "Enter the number of rows:" << endl; cin>>rows; cout<<"\n"; cout<<"Here, your pattern\n"; for(i=rows; i>=1; i--){ for(j=i; j<=rows; j++){ cout<<((char)(j+64)); } cout<<"\n"; } getch(); return 0; }
When the above code is executed, it produces the following results
Enter the number of rows: 6 Here, your pattern F EF DEF CDEF BCDEF ABCDEF
Program 6
#include <iostream> #include <conio.h> using namespace std; int main() { int i,j,rows; cout << "Enter the number of rows:" << endl; cin>>rows; cout<<"\n"; cout<<"Here, your pattern\n"; for(i=rows; i>=1; i--){ for(j=rows; j>=i; j--){ cout<<((char)(j+64)); } cout<<"\n"; } getch(); return 0; }
When the above code is executed, it produces the following results
Enter the number of rows: 6 Here, your pattern F FE FED FEDC FEDCB FEDCBA
Program 7
#include <iostream> #include <conio.h> using namespace std; int main() { int i,j,rows; cout << "Enter the number of rows:" << endl; cin>>rows; cout<<"\n"; cout<<"Here, your pattern\n"; for(i=rows; i>=1; i--){ for(j=1; j<=i; j++){ cout<<((char)(j+64)); } cout<<"\n"; } getch(); return 0; }
When the above code is executed, it produces the following results
Enter the number of rows: 6 Here, your pattern ABCDEF ABCDE ABCD ABC AB A
Program 8
#include <iostream> #include <conio.h> using namespace std; int main() { int i,j,rows; cout << "Enter the number of rows" << endl; cin>>rows; cout << "\nHere your pattern\n" << endl; for(i=1; i<=rows; i++){ for(j=1; j<=i; j++){ cout<<((char)(rows-i+1+64)); } cout<<"\n"; } getch(); return 0; }
When the above code is executed, it produces the following results
Enter the number of rows 6 Here your pattern F EE DDD CCCC BBBBB AAAAAA
Program 9
#include <iostream> #include <conio.h> using namespace std; int main() { int i,j,rows; cout << "Enter the number of rows" << endl; cin>>rows; cout << "\nHere your pattern\n" << endl; for(i=rows; i>=1; i--){ for(j=1; j<=i; j++){ cout<<((char)(i+64)); } cout<<"\n"; } getch(); return 0; }
When the above code is executed, it produces the following results
Enter the number of rows 6 Here your pattern FFFFFF EEEEE DDDD CCC BB A
Program 10
#include <iostream> #include <conio.h> using namespace std; int main() { int i,j,rows; cout << "Enter the number of rows" << endl; cin>>rows; cout << "\nHere your pattern\n" << endl; for(i=1; i<=rows; i++){ for(j=rows; j>=i; j--){ cout<<((char)(j+64)); } cout<<"\n"; } getch(); return 0; }
When the above code is executed, it produces the following results
Enter the number of rows 6 Here your pattern FEDCBA EDCBA DCBA CBA BA A
Program 11
#include <iostream> #include <conio.h> using namespace std; int main() { int i,j,rows; cout << "Enter the number of rows" << endl; cin>>rows; cout << "\nHere your pattern\n" << endl; for(i=rows; i>=1; i--){ for(j=i; j>=1; j--){ cout<<((char)(j+64)); } cout<<"\n"; } getch(); return 0; }
When the above code is executed, it produces the following results
Enter the number of rows 6 Here your pattern FEDCBA EDCBA DCBA CBA BA A
Program 12
#include <iostream> #include <conio.h> using namespace std; int main() { int i,j,rows; char alphabet='A'; cout << "Enter the number of rows" << endl; cin>>rows; cout << "\nHere your pattern\n" << endl; for(i=1; i<=rows; i++){ for(j=1; j<=i; j++){ cout<<alphabet++; } cout<<"\n"; } getch(); return 0; }
When the above code is executed, it produces the following results
Enter the number of rows 6 Here your pattern A BC DEF GHIJ KLMNO PQRSTU
Program 13
#include <iostream> #include <conio.h> using namespace std; int main() { int i,j,rows,num,count1; cout << "Enter the number of rows" << endl; cin>>rows; cout << "\nHere your pattern\n" << endl; for(i=1; i<=rows; i++){ num=rows-1; count1=i; for(j=1; j<=i; j++){ cout<<((char)(count1+64)); count1=count1+num; num--; } cout<<"\n"; } getch(); return 0; }
When the above code is executed, it produces the following results
Enter the number of rows 6 Here your pattern A BG CHL DIMP EJNQS FKORTU
Program 14
#include <iostream> #include <conio.h> using namespace std; int main() { int i,j,k,rows; cout << "Enter the number of rows" << endl; cin>>rows; cout << "\nHere your pattern\n" << endl; for(i=rows; i>=1; i--){ k=i; for(j=1; j<=i; j++,k++){ cout<<((char)(k+64)); } cout<<"\n"; } getch(); return 0; }
When the above code is executed, it produces the following results
Enter the number of rows 6 Here your pattern FGHIJK EFGHI DEFG CDE BC A
Program 15
#include <iostream> #include <conio.h> using namespace std; int main() { int i,j,k,rows; cout << "Enter the number of rows" << endl; cin>>rows; cout << "\nHere your pattern\n" << endl; for(i=1; i<=rows; i++){ for(j=i; j<=rows; j++){ cout<<((char)(j+64)); } cout<<"\n"; } getch(); return 0; }
When the above code is executed, it produces the following results
Enter the number of rows 6 Here your pattern ABCDEF BCDEF CDEF DEF EF F
Suggested for you
Nested for loop in C++
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…