Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

In this assignment, you will be learning Scheme through the use of Dr. Racket. W

ID: 3813711 • Letter: I

Question

In this assignment, you will be learning Scheme through the use of Dr. Racket. We would like to start with some basic concepts; trying to under prefix notation and the use procedure in Scheme. You will also implement nested procedures and recursive procedures. You may only use the procedures shown in the text and slides - not any of the additional library procedures in Scheme.

Using Dr. Racket to compute the following expressions.

Define a recursive procedure called “Multiply” that will compute the product of x times y. You must implement Multiply procedure by a sequence of additions. [5 points]

You can use the built-in + operation.

You will need to account for negative values as well.

> (Multiply 8 3)

24

> (Multiply 8 3)

24

Explanation / Answer

call the function recursively a= b times i.e a=a+multiply(a,b-1)

(define (Multiply a b)
(if (= b 0)
0
(+ a (Multiply a (- b 1)))))
  
> (Multiply 8 3)