Question: In this assignment we will use recursion to create Pascal's Triangle. Pascal's triangle is a triangular array of numbers in which the ends of each

 In this assignment we will use recursion to create Pascal's Triangle.

In this assignment we will use recursion to create Pascal's Triangle. Pascal's triangle is a triangular array of numbers in which the ends of each row is equal to 1 and each of the other values that makeup the triangle are the sum of the two numbers adjacent to each other in the row above. Below is a visual: 1st row 1 1 sth row 110 10 1 NOTE: As you can see the apex of the triangle has a value of 1. The perimeter values of the triangle always have a value of 1. The values that comprise the inner portion of the triangle are computed by taking the value(s) in the row above and adding them together. For example: row 0 has a value of 1. Al subsequent rows have on their perimeters the value of 1. Row 1 will have no inner value since it is comprised of just two values. Row 2 will have an inner value of 2 this is computed by adding the two adjacent values in the above (row 1). So 1 1 2. Row 3 is computed by adding the 1+2 -3 and once again 1 2-3 (remember you need to add all adjacent numbers). Row 4 is computed by adding 1 3 4, 3+ 3-6 and 31-4. This pattern continues until the program computes all the desired rows. Your program will allow the user to input the value for the number of rows in a Pascal Triangle and then print out the triangle itself. NOTE: This assignment MUST use RECURSION

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!