double loop

i get output lik


*
**
***
****
*****

but how can i change it like

*****
****
***
**
*


please help this question mae me carzy ahhhhhhhhhhhhhh
Last edited on
Show your code and we can help. The one that you say your output is
*
**
***
****
*****
Last edited on
#include <iostream>

using namespace std;

int main()
{
for (int i=1 ;i<=4; i++)
{
for(int j=1; j<=i ; j++)
{
cout<<"*"<<" ";
}
cout<<endl;
}
return 0;
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <iostream>

using namespace std;

int main()
{
    for (int i=1 ;i<=4; i++)
    {
        for(int j=1; j<=i ; j++)
        {
            cout<<"*"<<" ";
        }
        cout<<endl;
    }
    return 0;
now help out of this
Try this:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
xinclude <iostream>

using namespace std;

int main()
{
    int x = ...;
    for (int i=0 ;i<x; i++)
    {
        for(int j=0; j<x-i ; j++)
        {
            cout<<"*"<<" ";
        }
        cout<<endl;
    }
    return 0;
Topic archived. No new replies allowed.