- 2
How to cout triangle in c++?
Using Nested Loops. (Anyone here?
14 Respostas
+ 9
Did you tried doing it by own??
+ 4
+ 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
+ 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.
+ 2
Thanks guys
+ 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++;
+ 1
Bluesea thanks but, I need program
+ 1
Yes
+ 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;
}
}
+ 1
I this code that I have sent above print outs triangle of * but I need triangle code of numbers from 1 to 5
+ 1
https://code.sololearn.com/cqByYSH0p35s/?ref=app
This may help you
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;
}
0
Inayatullah Khorkhani Balouch is this what you wantđ