In this tutorial we are going to learn writing program in C to print pascal triangle.
But before directly moving on writing program first lets know
What is Pascal Triangle?
Pascal Triangle starts with row n = 0 where there is only one entry 1.
And it grows row wise toward right by adding previous and next item of the previous row.
- The initial number in the first row is 1 (the sum of 0 and 1),
- In second row, addition of 0+1 = 1 and 1+0 = 1. So 1 1 in second row.
- When we move on 3rd row then 0+1 = 1, 1+1=2 and 1+0 = 1. So elements of triangle in 3rd row is 1 2 1.
Following this approach pascal triangle grows.