Upright right half triangle of alphabets (column-wise increasing) – CSKC
Sign In

Search

Code Learning #CPP#2814    siteicon   siteicon  

Upright right half triangle of alphabets (column-wise increasing)

Print the right half upright pyramid of column wise increasing alphabets like follows –
A
A B
A B C

Learning Objectives

  • Printing upright right half triangle of increasing series of alphabets.

Source Code

TC++ #2814

 

Source Code

×

Ask AI About This Code

Default Prompt that is passed along with the code is given below, You can write your own prompt if you so desire.



×

Test CPP

  Related ( ? ) :

Code Understanding

int cnt; cout<<“Give row count : “; cin>>cnt; //Row count collected from user
for(int i=1;i<=cnt;i++) //Outer loop for row count
{
for(int j=1;j<=i;j++) //Inner Loop for column count, Column keep increasing with each iteration
cout<<char (j+64)<<” “; //The inner loop count is printed after adding 64 and converted to character type, first it will be A, then A B, then A B C and so on
cout<<“n”; //Next line after inner loop
}
}


Suggested Filename(s): pat-rht-alpha.cpp,prht-alp.cpp



Share

Created: 19-Jan-2018 23:55 | Updated: 29-Jan-2018 19:36|