How to print this pattern use "for" ???

[IMG]http://ser1.share.ysk.cc/upload/photo/20091112/754158.JPG[/IMG]
:?::?::?:

Recommended Answers

All 2 Replies

Where is the code you have tried ???

Where is the code you have tried ???

int r,c;
    for (r=1; r!=5; r++)
    {
        for (c=0; c<7; c++)
        {
            if (c>3-r && c<3+r)
                printf("* ");
            else
                printf("  ");
        }
        printf("\n");
    }

    return 0;
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.