- 2

How to cout triangle in c++?

Using Nested Loops. (Anyone here?

5th Mar 2020, 5:21 PM
Inayatullah Khorkhani Balouch
Inayatullah Khorkhani Balouch - avatar
14 Réponses
+ 9
Did you tried doing it by own??
5th Mar 2020, 5:27 PM
Ketan [#Be Happy 😄]
Ketan [#Be Happy 😄] - avatar
+ 3
Hello Please add your code attempt when asking for help so the community can help you. Here are the 8 rules for getting help. https://www.sololearn.com/Blog/38/8-simple-rules-to-get-help-from-the-community Thank you
5th Mar 2020, 5:27 PM
BroFar
BroFar - avatar
+ 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
BroFar - avatar
+ 2
Thanks guys
5th Mar 2020, 5:35 PM
Inayatullah Khorkhani Balouch
Inayatullah Khorkhani Balouch - avatar
+ 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
Inayatullah Khorkhani Balouch - avatar
+ 1
Yes
5th Mar 2020, 6:52 PM
Inayatullah Khorkhani Balouch
Inayatullah Khorkhani Balouch - avatar
+ 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
Inayatullah Khorkhani Balouch - avatar
+ 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
Inayatullah Khorkhani Balouch - avatar
6th Mar 2020, 12:57 PM
Soham Kulkarni
Soham Kulkarni - avatar
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
Anmol Kumar - avatar
0
Inayatullah Khorkhani Balouch is this what you want🙄
6th Mar 2020, 12:50 PM
Anmol Kumar
Anmol Kumar - avatar