Friday, 24 January 2014

c program to print diamond pattern

Q c program to print diamond pattern

how to print diamond shape in c programming 

this code or c program print diamond in c 

#include<stdio.h>
int main()
{
int a,b=4,c,d,t,h,f,g,p;
for(a=1;a<b;a++)
{
printf(" ");
how to print diamond in cprogramming

}
    printf("*\n");

for(c=1; c<2;c++)
{
    printf("  ");
    for(d=1;d<4;d++)
    {
        printf("*");
    }
    printf("\n");
}
for(h=1;h<2;h++)
{

printf(" ");
for(t=1;t<=5;t++)
{

    printf("*");
}
}
printf("\n");
for(f=1;f<2;f++)
{
    printf("  ");
    for(g=1;g<4;g++)
    {
        printf("*");
    }
}


printf("  \n");
printf("   *");
}

No comments:

Post a Comment