Pattern 28: C Program to print number pattern using for loops
Number Pattern 4 in C-Language:
Write a Program to print below number pattern in C-Language
Enter how many rows you want : 5
5 4 3 2 1
5 4 3 2
5 4 3
5 4
5
Note: This program is one of the Series of Pattern programs in C.
Number Pattern C-Language Program :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
#include<stdio.h> int main() { int i,j,n; // Take input from the User printf("Enter how many rows you want : "); scanf("%d",&n); // Iterate from 1 to n ( Outer For Loop) for(i=1;i<=n;i++) { // Start from 'n' // Continue till we reach i ( Outer Loop Iterator) for(j=n;j>=i;j--) printf(" %d",j); printf("\n"); } return 0; } |
Program Output:
We are using GCC compiler to compile the program on Ubuntu Linux system.
Similar Number Patterns:
Similar Star pattern programs :
- Basic star pattern program (The square pattern with stars).
- Triangle star pattern program.
- Triangle star pattern program with Spaces.
- Pyramid star pattern.
- Reverse Pyramid program.
- Diamond Star pattern program.
- star pattern program.
- K-Star pattern program.
- Empty Rhombus program.
- X-Star pattern program
- More Star Patterns