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
- [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,
- [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,
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
