Program :
#include
#include
void main()
{
int i,j,k,s=1;
clrscr();
for (i=1; i<=8; i++)
{
for (k=s; k<=8; k++)
{
printf(" ");
}
for (j=0; j< i; j++)
{
printf("*");
}
s = s + 1;
printf("\n");
}
s = 1;
for (i=7; i>=1; i--) {
for (k=s; k>=0; k--)
{
printf(" ");
}
for (j=i; j>=1; j--)
{
printf("*");
}
s = s + 1;
printf("\n");
}
getch();
}
Output :
*
**
***
****
*****
******
*******
********
*******
******
*****
****
***
**
*
#include
#include
void main()
{
int i,j,k,s=1;
clrscr();
for (i=1; i<=8; i++)
{
for (k=s; k<=8; k++)
{
printf(" ");
}
for (j=0; j< i; j++)
{
printf("*");
}
s = s + 1;
printf("\n");
}
s = 1;
for (i=7; i>=1; i--) {
for (k=s; k>=0; k--)
{
printf(" ");
}
for (j=i; j>=1; j--)
{
printf("*");
}
s = s + 1;
printf("\n");
}
getch();
}
Output :
*
**
***
****
*****
******
*******
********
*******
******
*****
****
***
**
*
No comments:
Post a Comment