How can I output this with a for loop? In cpp. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

How can I output this with a for loop? In cpp.

12345 1234 123 12 1

6th May 2019, 7:17 PM
Azat Hajyyev
Azat Hajyyev - avatar
4 Answers
+ 7
for(int i=0;i<5;i++) { for(int j=1;j<=5-i;j++) { cout<<j; } cout<<endl; } You can also replace the 5 by any number, i.e based on how many line you want to print
7th May 2019, 1:03 AM
Vivek Raj
Vivek Raj - avatar
+ 3
Vivek Raj thank you👍
7th May 2019, 4:55 AM
Azat Hajyyev
Azat Hajyyev - avatar
+ 2
~ swim ~ thanks!
7th May 2019, 4:54 AM
Azat Hajyyev
Azat Hajyyev - avatar
0
hi Azat Hajyyev where did you learn English language, can you help me to learn
8th May 2019, 6:08 AM
Kamoladdin !
Kamoladdin ! - avatar