Pyramid Program 6
C Program:
#include<stdio.h> #include<conio.h> void main() { int a,b,n,c=1,d=1; clrscr(); printf("enter no"); 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 ",d); } printf("\n");d++; } getch(); }
No comments