Pattern 27: C program to print below pyramid Number Pattern
Number Pattern 3:
Write a C Program to print below number pattern on the console:
Enter how many rows you want : 5
5 4 3 2 1
4 3 2 1
3 2 1
2 1
1
At each row we are removing the first number of previous row.
Note: This program is one of the Series of Pattern programs in C.
Number Pattern Program:
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 the input from the User printf("Enter how many rows you want : "); scanf("%d",&n); // loop starts from 'n' ( the User input ) to 0 for(i=n;i>0;i--) { for(j=i;j>0;j--) printf(" %d",j); printf("\n"); } return 0; } |
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
Write a program to print the given pattern.
Input Format:
Input consists of a single integer.
Output Format:
Refer sample outputs. There is a trailing space at the end of each line.
Sample Input:
5
Sample Output:
1 2 3 4 5
2 3 4 5
3 4 5
4 5
5
#include
#include
int main()
{
int j, num;
printf(“Enter a Number: “);
scanf(“%d”, &num);
printf(“\n”);
j = 1;
for(int k = 1; k <= num; k++)
{
for( ; j <= num; j++)
printf("%d ", j);
j = k + 1;
printf("\n");
}
return 0;
}
OUTPUT:..
Enter a Number: 5
1 2 3 4 5
2 3 4 5
3 4 5
4 5
5