Number Pattern 59-Rectangle pattern in C programming
Contents
hide
In this program, we will see the Rectangle pattern numbers in C programming language. Please look into the program.
1 2 3 4 5 16 6 15 7 14 8 13 12 11 10 9
The C program for Pyramid pattern is as follows:
#include <stdio.h> int main() { int a,b,c=6,l=13,m=16; for(a=1;a<=5;a++) { for(b=1;b<=5;b++) { if(a==1) printf("%-3d",b); else if(b==5) printf("%-3d",c++); else if(a==5) printf("%-3d",l--); else if(b==1) printf("%-3d",m--); else printf(" "); } printf("n"); } getch(); return 0; }