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

Search

Code Learning #CPP#2854    siteicon   siteicon  

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

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

 

 

Learning Objectives

  • Printing upright right half triangle of row wise increasing series of alphabets and same alphabet in each column.

Source Code

TC++ #2854

 

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 (i+64)<<” “;
The outer loop count is printed after adding 64 and converted to character type, first it will be A, then B B, then C C C and so on. Since we are printing the outer loop count in this case so every row gives the same symbol.

cout<<“n”; //Next line after inner loop
}
}


Suggested Filename(s): pat-rht-alprw.cpp,prht-arw.cpp



Share

Created: 20-Jan-2018 19:12 | Updated: 20-Jan-2018 19:12|