program for printing pyramid
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,k,n;
clrscr();
printf("enter
the number=");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
for(j=i;j<=n-1;j++)
{
printf("
");
}
for(k=1;k<=i;k++)
{
printf("*");
}
for(k=2;k<=i;k++)
{
printf("*");
}
printf("\n");
}
getch();
}
Output
enter the number=6
*
***
*****
*******
*********
***********
Comments
Post a Comment