hello all,
i am trying to make a program using nested for loops that outputs a triangle made of *. so far i have part of the triangle, but am having diffuculty finishing it. my code so far:
#include<iostream>
#include<conio.h>
using namespace std
void main()
{
int n = 5;
char usr = '*';
int x;
int y;
for(y=1;y<=n;y++)
{
for(x=1;x<=y;x++)
{
cout<<usr;
}
cout<<endl;
}
getch();
}
it looks like this:
*
**
***
****
*****
but i want it to look like this:
*
**
***
****
*****
****
***
**
*
any help would be appreciated