FREE ASSISTANCE FOR THE INQUISITIVE PEOPLE
Tutorial Topics
Pyramid with numbers I Pyramid with Alphabets
Pyramid with numbers II - Pattern - C Language
3199    Arnab De    09/07/2019

### Write a C Program to print the pattern shown in the figure [Pyramid]

In this type of program we always find how many column present in a particular row. Because we know that we are always print in VDU horizontally. Here column number is same as (row number * 2 ) - 1 and the spaces are present at the right side of the character is equal to the (total no of row - current row). It is Pyramid which numbers are decrease in each row until the column number is equal to the row number.

```#include <stdio.h>

void main()
{
int r,c,n,s,p,fl=1;
printf("Enter Total Number of row : ");
scanf("%d",&n);

for(r=1;r<=n;r++)
{
p=r;
for(s=1;s<=n-r;s++)
{
printf(" ");
}
for(c=1;c<=2*r-1;c++)
{
printf("%d",p);
if(c==r){fl=0;}
((fl==1)?(p--):(p++));
}
fl=1;
p=1;
printf("\n");
}
}
```

### OUTPUT :

Enter Total Number of row : 6

```     1
212
32123
4321234
543212345
65432123456
```
Pyramid with numbers I Pyramid with Alphabets
Author Details
Arnab De
I have over 16 years of experience working as an IT professional, ranging from teaching at my own institute to being a computer faculty at different leading institute across Kolkata. I also work as a web developer and designer, having worked for renowned companies and brand. Through tutorialathome, I wish to share my years of knowledge with the readers.
Enter New Comment
Comment History
No Comment Found Yet.
The biggest changes in a women's nature are brought by love; in man, by ambition
Rabindranath Tagore
557
54.7
Today So Far
Total View (Lakh)
26/05/2018     42637
01/01/2018     36193
25/06/2018     34314
28/06/2017     34308
02/08/2017     32620
01/08/2017     27136
06/07/2017     26963
15/05/2017     26592
14/07/2017     22156
21/04/2018     20848