Vinnibabu,

Welcome to the Ranch.

We do not just hand out solutions. We would rather you try on your own and learn on the way. If you have seen the other posts, you will have noticed that people post their code and other people help them figure out what is wrong with it.

Coming back to your problem.

It can be analyzed as follows:

1) The first line contains 1 star.

2) The second line contains 2 stars

3) The third line contains 3 stars

n) The nth line will contain n stars.

As you can see there is a

pattern here. The number of stars match the line number.

Now can you tell us how you will go about solving the problem?