A simple query

This is a discussion on A simple query within the C++ Programming forums, part of the General Programming Boards category; I found this puzzle in some book and i dont know the solution. please tell me how to write this ...

First, you'll need to figure out how to describe the shape mathematically. Try coming up with a formula relating the line number to the number of stars on that line.
Then it's just a matter of putting that formula into the while loop, which will be a breeze.