Skip to content

Instantly share code, notes, and snippets.

View cngdean's full-sized avatar

Carmen cngdean

View GitHub Profile
@cngdean
cngdean / gist:3702b7be4b6d298dd69c
Last active July 16, 2018 13:17
scala hackerrank i/o stdin stdout
object hackerrank {
object Solution {
def main(args: Array[String]) {
def fact(n: Int): Int = if (n == 1) 1 else n * fact(n - 1)
for (n <- io.Source.stdin.getLines) {
print(fact(Integer.parseInt(n.toString)) + "\n")
}
}
}