Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Java help

Name: Anonymous 2011-10-17 0:03

Hey guys I need help with my java coding. I'm required to write a code that takes 3 numbers (user input) and sort them from smallest to largest. Can someone show me how to code this?

Name: Anonymous 2011-10-18 16:10

(define sort3
  (lambda (a b c)
    (cond ((and (<= a b) (<= b c)) (list a b c))
          ((and (<= a c) (<= c b)) (list a c b))
          ((and (<= b a) (<= a c)) (list b a c))
          ((and (<= b c) (<= c a)) (list b c a))
          ((and (<= c a) (<= a b)) (list c a b))
          ((and (<= c b) (<= b a)) (list c b a)))))

(define run
  (letrec ((n1 (read))
           (n2 (read))
           (n3 (read))
           (r (sort3 n1 n2 n3)))
    (map (lambda (x) (print x) (newline)) r)))

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List