Skip to content

Instantly share code, notes, and snippets.

@choupi
Created January 7, 2015 03:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save choupi/b794dccacc10d6f376e4 to your computer and use it in GitHub Desktop.
Save choupi/b794dccacc10d6f376e4 to your computer and use it in GitHub Desktop.
GCD in haskell
mgcd :: Int -> Int -> Int
mgcd a b
| b > a = mgcd b a
| b==1 = 1
| b==0 = a
| otherwise = mgcd b (a `mod` b)
main = print (mgcd 45 6)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment