C Programming

Numeric Pyramid

C programming for construct numeric pyramid

5/31/2018
0 views
numeric-pyramid.cC
#include<stdio.h>

int main() {
	int i, j, k, l;
	for(i=1; i<=5; i++) {

		/* Print blank space */
		for(j=i; j<=5; j++)
			printf(" ");

		/* construct left side of the pyramid */
		for(k=1; k<=i; k++)
			printf("%d",k);

		/* Construct  right side of the pyramid */
		for(l=i-1; l>=1; l--)
			printf("%d",l);
		printf("\n");
	}
	return 0;
}


/* Output */
     1
    121
   12321
  1234321
 123454321
C programmingnumeric pyramidnumeric pyramid

Related Examples