#include
#include
using namespace std;
int main()
{
int i,j,rows;
cout << "Enter the number of rows:" << endl;
//get input from the user for number of rows
cin>>rows;
cout<<"\n";
cout<<"Here, your pattern\n";
i=rows;
do{
j=1;
do{
cout<<((char)(j+64));
j++;
} while( j<=i);
cout<<"\n";
i--;
}while( i>=1);
getch();
return 0;
}
When the above code is executed, it produces the following results
Alphabet pattern 1
Code to Alphabet triangle pattern 2
Program 2
#include
#include
using namespace std;
int main()
{
int i,j,rows;
cout << "Enter the number of rows" << endl;
//get input from the user for number of rows
cin>>rows;
cout<<"\n";
i=1;
do{
j=1;
do{
cout<<(char)(j+64);
j++;
}while(j<=i);
i++;
cout<<"\n";
}while(i<=rows);
getch();
return 0;
}
When the above code is executed, it produces the following results
Alphabet pattern 2
Code to Alphabet triangle pattern 3
Program 3
#include
#include
using namespace std;
int main()
{
int i,j,rows;
cout << "Enter the number of rows" << endl;
//get input from the user for number of rows
cin>>rows;
cout<<"\n";
i=rows;
do{
j=i;
do{
cout<<((char)(j+64));
j--;
}while(j>=1);
i--;
cout<<"\n";
}while(i>=1);
getch();
return 0;
}
When the above code is executed, it produces the following results
Alphabet pattern 3
Code to Alphabet triangle pattern 4
Program 4
#include
#include
using namespace std;
int main()
{
int i,j,k,rows;
cout << "Enter the number of rows" << endl;
//get input from the user for number of rows
cin>>rows;
cout << "\nHere your pattern\n" << endl;
i=1;
do{
j=i;
do{
cout<<((char)(j+64));
j++;
}while(j<=rows);
cout<<"\n";
i++;
}while( i<=rows);
getch();
return 0;
}
When the above code is executed, it produces the following results
Alphabet pattern 4
Code to Alphabet triangle pattern 5
Program 5
#include
#include
using namespace std;
int main()
{
int i,j,rows;
cout << "Enter number of rows: ";
//get input from the user for number of rows
cin>>rows;
cout << "\nHere your pattern\n\n";
i=1;
do{
j=i;
do{
cout<<((char)(i+64));
j++;
}while(j<=rows);
cout<< endl;
i++;
} while(i<=rows);
getch();
return 0;
}
When the above code is executed, it produces the following results
Alphabet pattern 5
Code to Alphabet triangle pattern 6
Program 6
#include
#include
using namespace std;
int main()
{
int i,j,rows;
char ch='A';
cout<<"Enter the number of rows: ";
//get input from the user for number of rows
cin>>rows;
i=1;
do{
j=1;
do{
cout<
When the above code is executed, it produces the following results
Alphabet pattern 6
Code to Alphabet triangle pattern 7
Program 7
#include
#include
using namespace std;
int main()
{
int i,j,rows;
char ch='A';
cout<<"Enter the number of rows: ";
//get input from the user for number of rows
cin>>rows;
i=1;
do{
j=1;
do{
cout<<((char)(j+64))<<" ";
j++;
}while(j<=(i*2-1));
i++;
cout<<"\n";
} while(i<=rows);
getch();
return 0;
}
When the above code is executed, it produces the following results
Alphabet pattern 7
Code to Alphabet triangle pattern 8
Program 8
#include
#include
using namespace std;
int main()
{
int i,j,rows;
cout << "Enter number of rows: ";
//get input from the user for number of rows
cin>>rows;
cout << "\nHere your pattern\n\n";
i=1;
do{
j=1;
do{
cout<<(char)(i+64);
j++;
} while(j<=i);
cout<< endl;
i++;
} while(i<=rows);
getch();
return 0;
}
When the above code is executed, it produces the following results
Alphabet pattern 8
Code to Alphabet triangle pattern 9
Program 9
#include
#include
using namespace std;
int main()
{
int i,j,rows,num,count1;
cout<<"Enter the number of rows: ";
//get input from the user for number of rows
cin>>rows;
i=1;
do{
num=rows-1;
count1=i;
j=1;
do{
cout<<(char)(count1+64)<<" ";
count1=count1+num;
num--;
j++;
}while(j<=i);
i++;
cout<<"\n";
}while(i<=rows);
getch();
return 0;
}
When the above code is executed, it produces the following results
Alphabet pattern 9
Code to Alphabet triangle pattern 10
Program 10
#include
#include
using namespace std;
int main()
{
int i,j,rows;
cout << "Enter number of rows: ";
//get input from the user for number of rows
cin>>rows;
cout << "\nHere your pattern\n\n";
i=rows;
do{
j=i;
do{
cout<<(char)(j+64);
j++;
} while(j<=rows);
cout<< endl;
i--;
}while(i>=1);
getch();
return 0;
}
When the above code is executed, it produces the following results
Alphabet pattern 10
Code to Alphabet triangle pattern 11
Program 11
#include
#include
using namespace std;
int main()
{
int i,j,rows;
cout << "Enter number of rows: ";
//get input from the user for number of rows
cin>>rows;
cout << "\nHere your pattern\n\n";
i=1;
do{
j=i;
do{
cout<<(char)(j+64);
j--;
}while(j>=1);
cout<< endl;
i++;
}while(i<=rows);
getch();
return 0;
}
When the above code is executed, it produces the following results
Alphabet pattern 11
Code to Alphabet triangle pattern 12
Program 12
#include
#include
using namespace std;
int main()
{
int i,j,rows;
cout << "Enter number of rows: ";
//get input from the user for number of rows
cin>>rows;
cout << "\nHere your pattern\n\n";
i=1;
do{
j=1;
do{
cout<<(char)(rows-i+1+64);
j++;
}while(j<=i);
cout<< endl;
i++;
}while(i<=rows);
getch();
return 0;
}
When the above code is executed, it produces the following results
Alphabet pattern 12
Code to Alphabet triangle pattern 13
Program 13
#include
#include
using namespace std;
int main()
{
int i,j,rows;
cout << "Enter number of rows: ";
//get input from the user for number of rows
cin>>rows;
cout << "\nHere your pattern\n\n";
i=rows;
do{
j=rows;
do{
cout<<(char)(j+64);
j--;
}while(j>=i);
cout<< endl;
i--;
} while(i>=1);
getch();
return 0;
}
When the above code is executed, it produces the following results
Alphabet pattern 13
Code to Alphabet triangle pattern 14
Program 14
#include
#include
using namespace std;
int main()
{
int i,j,rows;
cout << "Enter number of rows: ";
//get input from the user for number of rows
cin>>rows;
cout << "\nHere your pattern\n\n";
i=rows;
do{
j=1;
do{
cout<<(char)(i+64);
j++;
}while(j<=i);
cout<< endl;
i--;
}while(i>=1);
getch();
return 0;
}
When the above code is executed, it produces the following results
Alphabet pattern 14
Code to Alphabet triangle pattern 15
Program 15
#include
#include
using namespace std;
int main()
{
int i,j,rows;
cout << "Enter number of rows: ";
//get input from the user for number of rows
cin>>rows;
cout << "\nHere your pattern\n\n";
i=1;
do{
j=rows;
do{
cout<<(char)(j+64);
j--;
}while(j>=i);
cout<< endl;
i++;
} while(i<=rows);
getch();
return 0;
}
When the above code is executed, it produces the following results