Advertisement
xathrya

Min Antara Max

Feb 10th, 2015
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. min3 :: Int->Int->Int->Int
  2. min3 a b c
  3.     | (a>b)&&(c>b) = b
  4.     | (a>c)&&(b>c) = c
  5.     | (b>a)&&(c>a) = a
  6.  
  7. max3 :: Int->Int->Int->Int
  8. max3 a b c
  9.     | (a>b)&&(a>c) = a
  10.     | (b>a)&&(b>c) = b
  11.     | (c>a)&&(c>b) = c
  12.  
  13.  
  14. nilaiantara :: Int -> Int ->Int -> Int
  15. nilaiantara a b c = (a+b+c) - (min3 a b c) - (max3 a b c)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement