Skip to main content
deleted 11 characters in body
Source Link
Gareth
  • 11.4k
  • 1
  • 36
  • 85

Scala, 9786 characters

object O extends App{def f(i:Int):Int=if(i>0)i%2+f(i/2)else 0
def main(a:Array[String])=printprint(f(aargs(0).toInt))}

Usage: scala O 56432

Scala, 97 characters

object O{def f(i:Int):Int=if(i>0)i%2+f(i/2)else 0
def main(a:Array[String])=print(f(a(0).toInt))}

Usage: scala O 56432

Scala, 86 characters

object O extends App{def f(i:Int):Int=if(i>0)i%2+f(i/2)else 0
print(f(args(0).toInt))}

Usage: scala O 56432

Source Link
Gareth
  • 11.4k
  • 1
  • 36
  • 85

Scala, 97 characters

object O{def f(i:Int):Int=if(i>0)i%2+f(i/2)else 0
def main(a:Array[String])=print(f(a(0).toInt))}

Usage: scala O 56432