#include<stdio.h> #include<conio.h> main() { int n,r=1,val,j; clrscr(); printf("enter the number of rows in the pyramid\t"); scanf("%d",&n); while(r<=n) { val=r; for(j=1;j<=n-r;j++) printf("\t"); for(j=1;j<=2*r-1;j++) if(j<=(2*r-1)/2) printf("%d\t",val++); else if(j==(2*r-1)/2+1) printf("%d\t",val); else printf("%d\t",--val); printf("\n"); r++; } getch(); }
In reply to Re^2: asterisk pattern
by Monk_perl
in thread asterisk pattern
by Monk_perl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |