*

* *
* * *
* * * *

/sorry its

{
   *
  *  *
 *  *  *
*  *  *  * 

also this

{
     *
    *  *
   *  *  *
 *  *  *  *
   *  *  *
     *  *
       *

/ can array[7][7] be used to print this ?

you can use for loop

yaa but am not gettin how to do

create two for loops. The outside loop should iterate but the inner loop should loop only once. And in the inner loop you can write if statements.
Example:

for(/*loop till n number of lines*/){
    for(/*loop only once*/){
        if(i==0){
                cout << "   *   ";
            }
            //so on
        }
    }

You can start off this way. Then you can improve and find a shorter way to print out the required "*".

to print these pattern you just go through nested loop.
if you are not aware of loop then Click Here for more detail on loop.

Ohk thanku

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.