Question: use scheme program The following pattern of numbers is called Pascal's triangle. The numbers at the edge of the triangle are all 1, and each

use scheme program

The following pattern of numbers is called Pascal's triangle. The numbers at the edge of the triangle are all 1, and each number inside the triangle is the sum of the two numbers above it.

(pascals 0 0)  1 (pascals 2 0)  1 (pascals 2 1)  2 (pascals 4 2)  6 
(printTriangle 5) 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1
  1. [5 marks] Write a procedure that computes elements of Pascal's triangle given row and column indices. Any invalid indices should return a value of 0. For example,
  2. [7 marks] Using your solution to the previous part, write a procedure (printTriangle n) that prints n rows of Pascal's triangle to the screen. For example,
colo col 1 row 0 1 1 col 2 row 1 | 1 row 2 1 2 row 3 (1331) col 3 col 4

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!