pattern 32: Number pattern 7 program in C using for loops
Number Pattern 7 :
Write a C Program to print below number pattern 7 on the console. Here are couple example of input and expected output of the program
Example 1:
Enter how many rows you want : 5
1
2 1
3 2 1
4 3 2 1
5 4 3 2 1
Example 2:
Enter how many rows you want : 10
1
2 1
3 2 1
4 3 2 1
5 4 3 2 1
6 5 4 3 2 1
7 6 5 4 3 2 1
8 7 6 5 4 3 2 1
9 8 7 6 5 4 3 2 1
10 9 8 7 6 5 4 3 2 1
📢 Note: This program is one of the Series of Number pattern programs in C.
Program to print above Number pattern 7 :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
#include<stdio.h> int main() { int i,j,n; // Take number of rows as the input printf("Enter how many rows you want : "); scanf("%d",&n); // Loop starts from '1' and goes till 'n' for(i=1;i<=n;i++) { for(j=i;j>0;j--) printf(" %d",j); printf("\n"); } return 0; } |
Program Output :
Similar Number Patterns:
- Basic Number Pattern program.
- Triangle Number pattern using for loops.
- Number Pattern 3.
- C Program to print below pattern
- 5 4 3 2 1
5 4 3 2
5 4 3
5 4
5 - C Program to print below pattern.
- 1
2 3
4 5 6
7 8 9 10 - C Program to print Below Pattern,
- 5
4 5
3 4 5
2 3 4 5
1 2 3 4 5
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