0 Replies - 1069 Views - Last Post: 18 July 2010 - 10:26 PM

#1 Crunch  Icon User is offline

  • D.I.C Lover
  • member icon

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

[Scheme] Pythagorean triple Check

Posted 18 July 2010 - 10:26 PM

Description:
(define check(lambda ( x y z )
  
             (if       (and ( > z 0 ) ( > y 0 ) (> x 0) ) 
  
             (cond                
          
             (  (= (+ ( * x x ) (* y y) ) (* z z) ) (display " True ")  )
             (  (= (+ ( * z z ) (* y y) ) (* x x) ) (display " True ")  )
             (  (= (+ ( * z z ) (* x x) ) (* y y) ) (display " True ")  )
             (else (display " False " ) )
                        
              )   
               
             (display "All numbers should be positive" )  ) 
  
  )  
  )


Is This A Good Question/Topic? 0
  • +

Page 1 of 1