Pyramid Program 7
C Program:
#include<stdio.h> #include<conio.h> void main() { int a,b,n,c=1,d; clrscr(); printf("Enter hieght of pyramid : "); scanf("%d",&n); for(a=0;a<n;a++) { for(b=0;b<=a;b++) {textcolor(GREEN); cprintf("."); } for(b=n;b>=a;b--) { cprintf("%d ",c); } //c++; printf("\n");c++; } for(a=0;a<=n;a++) { for(b=n;b>=a;b--) { textcolor(RED); cprintf("."); } for(b=0;b<=a;b++) { cprintf("%d ",c); } printf("\n");c--; } getch(); }
No comments