ProAnswers.org

Write a C program to generate the pyramid structure using numerical?

#include

#include 

void main() 

{ 

int k,i,j,x,p=34; 

clrscr(); 

printf(“Enter a number:”); 

scanf(“%d”, &x); 

for(j=0;j<=x;j++) 

{ 

gotoxy(p,j+1); 

for(i=0-j;i<=j;i++) 

printf(“%3d”, abs(i)); 

p=p-3; 

} 

getch(); 

} 

Output: 

Enter a number: 3 

0 

101 

21012 

3 210123