C++ Program to print the pattern of alphabet [DEVCPP/GCC]

/*Program to print the pattern of alphabets.

A
BC
DEF
GHIJ
KLMNO

*/

PROGRAM

# include <iostream>

using namespace std;

int main()
{
char c='A';
int i,j,rows;

cout<<"ENTER THE NUMBER OF ROWS:\n";
cin>>rows;
cout<<"\nPATTERN FORMED:\n";

for(i=1;i<=rows;i++)
{
for(j=1;j<=i;j++)
{
                       if(c=='Z')
                       {
                               cout<<c;
                               c='A';
                               continue;
                       }
cout<<c;
c++;
}
cout<<endl;
}

       return 0;
}

OUTPUT

C++ Program to print the pattern of alphabet

Share this

Related Posts

FIND US ON FACEBOOK!