Skip to content

Instantly share code, notes, and snippets.

@cesare
Created January 8, 2010 10:10
Show Gist options
  • Save cesare/271954 to your computer and use it in GitHub Desktop.
Save cesare/271954 to your computer and use it in GitHub Desktop.
def sumDigits(n:Int) = (0 /: ((n toString) toCharArray)) {(x,y) => x + y - '0'}
def displaySumDigits(n: Int) = println(sumDigits(n))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment