This is the coding i have done bt its nt printing in 'H' pattern.
Can anybody help m 2 print dis..??

This is the 'H' pattern i want 2 print :

*    * 
**  **
******
**  **
*    *

Coding :

#include<stdio.h>
#include<conio.h>
int main()
{
    int i, j, k;
    clrscr();
    for(i=0; i<5; i++)
    {
        for(j=0; j<=i; j++)
            printf("*");
        for(k=0; k<6-(2*j); k++)
            printf(" ");
        for(j=0; j<=i; j++)
            printf("*");
        printf("\n");
    }
    for(i--; i>0; i--);
    {
        for(j=0; j<i; j++)
            printf("*");
        for(k=0; k<6-(2*i); k++)
            printf(" ");
        for(j=0; j<i; j++)
            printf("*");
        printf("\n");
    }
    getch();
    return(0);
}

Use this simple loop

for(i=0;i<9;i++)
{
	for(j=0;j<9;j++)
	{
	if(j>2&&j<6&& i<3||j>2&&j<6&&i>5)	printf(" ");
	else printf("*");
	}
	printf("\n");
}

Best Of luck

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.