printing stars using Nested for loop

i want to print stars below using nested for loop.
**
****
******
i tried this code but, i didn't work.

#include <iostream>
using namespace std;

int main()
{

for (int row=0; row<3; row++)
{
for(int star=0; star<3; star+=1)
{
cout<<"*";
}

Obviously, that code will print 3 stars on every line. You see why that is so, yes?

What you need to do is figure out the relationship between the stars printed on one line, and the stars printed on the next line. Then think of a way to capture that relationship in the logic of your inner loop.
Topic archived. No new replies allowed.