Number Pattern 51-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.
12344321 123**321 12****21 1******1
The C program for Rectangle pattern is as follows:
#include<stdio.h> int main() { int a,b; for(a=4;a>=1;a--) { for(b=1;b<=4;b++) { if(b<=a) printf("%d",b); else printf(" "); } for(b=4;b>=1;b--) { if(b<=a) printf("%d",b); else printf(" "); } printf("n"); } getch(); return 0; }