#include "conio.h"
void main()
{
int i,a,b,c,d,n,m,x,y;
clrscr();
printf("Enter a number");
scanf("%d",&n);
m=n-1;
d=1;x=1;
y=n+2;
for(a=1; a<=n; a++)
{
for(b=1; b<=m; b++)
{
printf(" ");
}
for(c=1; c<=d; c=c+2)
{
printf("*");
}
printf("\n\n");
m--;
d+=2;
}
y=d-4;
for(a=1; a<=n; a++)
{
for(b=1; b<=x; b++)
{
if(b
printf(" ");
}
for(c=1; c<=y; c=c+2)
{
printf("*");
}
printf("\n\n");
x++;
y-=2;
}
getch();
}
Get the executable ( .exe ) file for this program..
Download
0 comments:
Post a Comment