Exercise 4: Pascal Triangle

In this exercise, you will be required to make a function which displays the Pascal Triangle for any size given

We'll cover the following

Problem Statement #

This is another C++ exercise about using a two-dimensional array of C++.

Write a C++ program to display a table that represents a Pascal triangle of any size.

Pascal triangle #

In Pascal triangle,

  • 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.

See the example Pascal triangle(size=5) below:

Create a free account to access the full course.

By signing up, you agree to Educative's Terms of Service and Privacy Policy