How to cout triangle in c++? | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
- 2

# How to cout triangle in c++?

Using Nested Loops. (Anyone here?

5th Mar 2020, 5:21 PM
Inayatullah Khorkhani Balouch
14 ответов
+ 9
Did you tried doing it by own??
5th Mar 2020, 5:27 PM
Ketan [#Be Happy 😄]
+ 4
5th Mar 2020, 8:52 PM
BroFar
+ 3
5th Mar 2020, 5:27 PM
BroFar
+ 3
Inayatullah Khorkhani Balouch exactly what type of triangle as there are several and your question is still unclear. Again please provide a code not a language and show us your attempt.
5th Mar 2020, 6:50 PM
BroFar
+ 2
Thanks guys
5th Mar 2020, 5:35 PM
Inayatullah Khorkhani Balouch
+ 2
1 to 5 means how? Can you show your Expexted output..? 1 12 123 Like this? If yes, then take n=1, just replace * with n++;
5th Mar 2020, 8:44 PM
Jayakrishna 🇮🇳
+ 1
Bluesea thanks but, I need program
5th Mar 2020, 6:40 PM
Inayatullah Khorkhani Balouch
+ 1
Yes
5th Mar 2020, 6:52 PM
Inayatullah Khorkhani Balouch
+ 1
#include<iostream> using namespace std; int main() { for(int i=0; i<=5; i++) { for(int j=0; j<=i; j++) { cout<<"*"<<" "; } cout<<endl; } }
5th Mar 2020, 6:53 PM
Inayatullah Khorkhani Balouch
+ 1
I this code that I have sent above print outs triangle of * but I need triangle code of numbers from 1 to 5
5th Mar 2020, 6:54 PM
Inayatullah Khorkhani Balouch
6th Mar 2020, 12:57 PM
Soham Kulkarni
6th Mar 2020, 10:38 AM
Hatem
0
#include <iostream> using namespace std; int main() { for(int i=1;i<=5;i++) { for(int j=1;j<=i;j++) { cout<<j; } cout<<"\n"; } return 0; }
6th Mar 2020, 12:49 PM
Anmol Kumar
0
Inayatullah Khorkhani Balouch is this what you want🙄
6th Mar 2020, 12:50 PM
Anmol Kumar
Актуальное сегодня
Py to Exe