Wednesday, March 10, 2010

another way

for (r = 1; r <= height; r++)
{
// print spaces
for (i = 1; i <= height - r; i++)
cout << " ";

// print stars
// print spaces
for (i = 1; i <= r * 2 - 1; i++)
cout << "*";

cout << endl;
}

No comments:

Post a Comment