Pascal triangle in C++

Pascal Triangle in C++

Here you will learn to make the program code of Pascal Triangle in C++ programming language.

Pascal Triangle Formula

Formula of Pascal triangle for nth row is given below:

C(n,k) = n! / (k! *(nk)!)

in which nth is the rows and kth is the element.

Pascal triangle in C++

Pascal Triangle in C++ using For loop

Output

Enter number of rows: 7
                        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

 

 

 

Check out our other C++ programming Examples

 

 

 

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top