Created
January 31, 2013 13:07
-
-
Save mahmoudhossam/4682727 to your computer and use it in GitHub Desktop.
Pascal Triangle in scala.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def pascal(c: Int, r: Int): Int = { | |
if(c == 0 || c == r) 1 else pascal(c, r-1) + pascal(c-1, r-1) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment