I need to print this triangle:
*
**
***
****
*****
******
*******
********
using a FOR and WHILE loop. I need help, I have already figured out the for loop version I just have to convert it to while loop but everything I try is not giving me the correct output! Any help is appreciated!
My code so far:
#include <iostream>
using namespace std;
int main(int argc, char**argv) {
int i = 1;
int j = 1;
int N = 8;
while (i <= N)
{
i = i++;
while(j <= i)
{
cout<<"*";
j = j++;
}
cout<<endl;
}
}