Can any one give me logic/code to make following patterns:
*
* *
* * *
* * * *
* * * * *
* * * * * *
I cant get the fig correctly but I want a fifure which will be an equilateral triangle with 1 star in 1st row,
2stars in 2nd row......6stars in 6th row
For the first triangle you start with a line containing a single star and then add one star each new line.
The second is like the first one but you add two stars each line.
I think you dint get my question. The solution you proposed will help me to get something like this
*
**
***
****
*****
******
But as I said I want an equilateral triangle with a star in mid of 1st row then 2stars in the next row like wise till we have 6stars. I mean the stars must form an equilateral triangle and not a riht triangle.
Unfortunately I cant get the figure correctly here using the editor provided as its ignoring the spaces.
Regarding 2nd: I cant understand how can I have 12stars in an odd series of(1,3,5,7,9 stars)
wel, can u give me a little more hint. All I can extract of the pattern is that spaces are decreasing by 1 and stars are increasing by 2 ie like an AP series.
I know I sound dumb but I am in learning phase.
suvojit168, programming is ALL about logical thinking. Within that, a lot of math is required. This is definitely not the most complex of mathematical problems you will find in programming. Go study basic algebra. You should figure this out on your own instead of relying on other people and online tutorials.