C Programs / Pyramid C Program

Program
#include
void pyramid ( int );
void main ()
{
int n;
printf("Enter n value:\n");
scanf("%d",&n);
printf("\n");
pyramid(n);
}
void pyramid ( int n )
{
int i,j;
for ( i=0; ii; j-- )
printf(" ");
for ( j=i; j>=0; j-- )
printf("%d",j);
for ( j=1; j<=i; j++ )
printf("%d",j);
printf("\n");
}
}
Input Enter n value:3
Output
  0

 101

21012


Home     Back