Exercise 4: Pascal’s Triangle
Create a function that displays the Pascal’s triangle for any given size.
We'll cover the following...
We'll cover the following...
Problem statement
Display Pascal’s triangle for the specified size. You’re given the printPascalTr(int size) function. It takes the given size and displays a table that represents the corresponding Pascal’s triangle.
In Pascal’s triangle:
The first and the second rows are set to
1.Each element of the triangle (from the third row downward) is the sum of the element directly above it and the element to the left of the element directly above it.