I do not know how to write the code multiply by 5 and count them when the list is multiplied

Viewed 33

Write a recursive function, mult5, that will return how many numbers in the list are multiples of 5. (mult5 ‘(60 22 13 25) ===> 2 (mult5 ‘(5) ===> 1 (mult5 ‘() ===> 0

(define (mult5 ls) (if (null? ls) '() (cons ( * car (ls) car(ls)) ( mult5 cdr (ls) cdr (ls)))))

0 Answers
Related