#include<stdio.h>
int main()
{
int n=15,i,j,n1;
n1=n-1;
printf("");
printf("\t\t\t\t *\n");
printf("\t\t\t\t *\n");
for(i=1;i<=n;i++)
{
printf("\t\t\t ");
if(i==1)
{
printf("\b\b**");
printf("*");
for(j=2;j<(n1/2);j++)
printf(" ");
for(j=n1/2;j<n1;j++)
printf("*");
printf("\n");
}
if(i>=2 && i<(n/2))
{
if(i==n/4+1)
{
printf("* * * *");
}
else
{
printf("*");
for(j=2;j<(n1/2);j++)
printf(" ");
printf("*");
}
printf("\n");
}
if(i==n/2)
{
for(j=1;j<n1;j++)
printf("*");
printf("\n");
}
if(i>(n/2) && i<n)
{
if(i==n-4)
{
printf(" * * * *");
}
else
{
for(j=1;j<(n1/2);j++)
printf(" ");
printf("*");
for(j=((n1/2)+1);j<n1-1;j++)
printf(" ");
printf("*");
}
printf("\n");
}
if(i==n)
{
for(j=1;j<=(n1/2);j++)
printf("*");
for(j=(n1/2)+1;j<n1-1;j++)
printf(" ");
printf("***");
printf("\n");
}
}
printf("\t\t\t *\n");
printf("\t\t\t *\n");
printf("\n\n\t\t\t\t\t\tGaurav\n");
return 0;
}
output:
-Gaurav Singhal
int main()
{
int n=15,i,j,n1;
n1=n-1;
printf("");
printf("\t\t\t\t *\n");
printf("\t\t\t\t *\n");
for(i=1;i<=n;i++)
{
printf("\t\t\t ");
if(i==1)
{
printf("\b\b**");
printf("*");
for(j=2;j<(n1/2);j++)
printf(" ");
for(j=n1/2;j<n1;j++)
printf("*");
printf("\n");
}
if(i>=2 && i<(n/2))
{
if(i==n/4+1)
{
printf("* * * *");
}
else
{
printf("*");
for(j=2;j<(n1/2);j++)
printf(" ");
printf("*");
}
printf("\n");
}
if(i==n/2)
{
for(j=1;j<n1;j++)
printf("*");
printf("\n");
}
if(i>(n/2) && i<n)
{
if(i==n-4)
{
printf(" * * * *");
}
else
{
for(j=1;j<(n1/2);j++)
printf(" ");
printf("*");
for(j=((n1/2)+1);j<n1-1;j++)
printf(" ");
printf("*");
}
printf("\n");
}
if(i==n)
{
for(j=1;j<=(n1/2);j++)
printf("*");
for(j=(n1/2)+1;j<n1-1;j++)
printf(" ");
printf("***");
printf("\n");
}
}
printf("\t\t\t *\n");
printf("\t\t\t *\n");
printf("\n\n\t\t\t\t\t\tGaurav\n");
return 0;
}
output:
-Gaurav Singhal
same here. but before 18 months i have no blog address..... thats why i have posted it very late....
ReplyDelete