0 Replies - 1239 Views - Last Post: 28 July 2010 - 08:20 PM

#1 Crunch   User is offline

  • D.I.C Lover
  • member icon

Reputation: 139
  • View blog
  • Posts: 1,222
  • Joined: 28-July 09

[Scheme] The Number of multiples of Z between X and Y

Posted 28 July 2010 - 08:20 PM

Description:
(define count 0)

(define (loop x y step z)
  (if (<= x y)
    (begin    
     
      (if (= 0 (modulo x z )) (set! count (+ count 1 )) ) 
      
      (loop (+ x step) y step z))))

(define check( lambda (x y z) 
          
                (if (< y x)  (display "Input error" )         
                (loop x y 1 z)  )
                (display count) (set! count 0) )
                    
 )

Is This A Good Question/Topic? 0
  • +

Page 1 of 1