Question: Question 1: (2.5 marks) Define a recursive procedure count-multiples that takes two arguments, a list of integers and an integer n, n 1. The

Question 1: (2.5 marks) Define a recursive procedure count-multiples that takes two arguments, a list of integers and an integer n, n 1. The procedure counts the number of elements in the list that are a multiple of n, by means of a recursive process. For example, > (count-multiples '(1 2 3 4 5 6) 1); returns 6 returns 3 > (count-multiples > (count-multiples '(1 2 3 4 5 6) 2); 3 4 5 6) 3) ; 3 4 5 6) 7) ; '(1 > (count-multiples '(1 returns 2 returns 0 (define (count-multiples 1st n) Question 2: (1.5 marks) Rewrite your solution to part (a) as procedure that generates an iterative process. Name this procedure count-multiples-iter
Step by Step Solution
There are 3 Steps involved in it
Question 1 To define a recursive procedure countmultiples that counts the number of elements in a list that are multiples of a given integer n we can ... View full answer
Get step-by-step solutions from verified subject matter experts
