Reputation: 57
I need some one can explain for me to how to do this please,
divisible-by-7?
Define your own Racket function that takes a single integer as an argument and returns a Boolean that indicates whether the number is evenly divisible by 7. You do not have to perform error checking on the input.
Input: An integer.
Output: A Boolean.
Example:
> (divisible-by-7? 14)
#t
> (divisible-by-7? 31)
#f
> (divisible-by-7? 56)
#t
this what I have but I keep receiving error
(define (divisible-by-7)
(divisible 7))
Upvotes: 1
Views: 740
Reputation: 257
It seems that divisible
is not a library procedure in racket.
Try
(define (divide-by-7? x)
(= (remainder x 7) 0))
Alternatively, if you would like to implement divisible?
in racket:
(define (divisible k)
(lambda (x)
(= (remainder x k) 0)))
and to use it:
(define divide-by-7?
(divisible 7))
Upvotes: 0