# 60 : C Program to display Pascal Triangle (Pyramid) sequence 8

Check out the complete list of c-programs : C Program List

We have seen half and full pyramid's of stars numbers and alphabets, now we need to create a Pascal's triangle. For this you need to know what a pascal triangle is,

A pascal's triangle is a triangular array of binomial coefficients. for more details read wiki page : http://en.wikipedia.org/wiki/Pascal's_triangle

To get this, we need to have 2 nested loops. One for row and second to print the numbers for the row.

To achive this you need to have 3 nested for loops.

```                   1

1   1

1   2   1

1   3   3   1

1   4   6   4   1

1   5  10  10   5   1

1   6  15  20  15   6   1

1   7  21  35  35  21   7   1
```

Variables :

i : Datatype int : Used in for loop1.

j : Datatype int : Used in for loop2.

Logic :

``````
for(i=1;i<10;++i)
{
for(j=1;j<=i;++j)
{
printf("%c ",i+64);   //we print our char i+64
}
printf("\n");
}``````

``````
/*
* 1000+ C programs + tutorials
*
*
* 57_c_program_to_display_half_pyramid_of_alphabets_sequence_4
*
*
*
*  Created on: Oct 22, 2014
*  Author: Code2care.org
*/

#include
//#include <conio.h>

void main() {

//    clrscr();

int coeff=1;
int i,j,k;

for(i=0;i<8;i++)
{
for(j=1;j<=8-i;j++) {

printf("  ");

}
for(k=0; k<=i; k++)
{
if (k==0 || i==0) {

coeff=1;
}
else {

coeff = coeff*(i-k+1)/k;
}

printf("%4d",coeff);
}
printf("\n");
}

//	getch();

}
```

```

• Output :

```		   1

1   1

1   2   1

1   3   3   1

1   4   6   4   1

1   5  10  10   5   1

1   6  15  20  15   6   1

1   7  21  35  35  21   7   1
```

The best way to learn C programming is to practice more and more of programs . Code2care C Programming tutorials provide 1000+ programs in C that you can study and become an expert in the language. Programs are divided into categories depending upon type and complexity.

BSc. IT, BSc. Computer Science, BSc. IT, MSc. IT, MSc. Computer Science, MCA, BTech IT & BTech Engineers may find these programs very useful.