I/O Operations Letter Pattern

Jammy is the trainer in Secondary school, he has given the task of printing the letter pattern.

Students has to create a logic which get the integer number which specify the number of rows and according to that students has to print the letter pattern

Programming language need to be used:C++



TEST CASE 1 

INPUT
7
OUTPUT
A
BC
DEF
GHIJ
KLMNO
PQRSTU
VWXYZAB

TEST CASE 2 

INPUT
6
OUTPUT
A
BC
DEF
GHIJ
KLMNO
PQRSTU




#include <iostream>
using namespace std;
int main() {

  int i,j,n;
char c;
cin>>n;
c='A';
for(i=0;i<n;i++)
{
for(j=0;j<=i;j++)
{

cout<<c;
c++;
          if(c=='[')
c='A';
}
cout<<endl;
}
  return 0;

}

Comments

Popular Posts