Factorial Algorithms in different languages
Posted
by Brad Gilbert
on Stack Overflow
See other posts from Stack Overflow
or by Brad Gilbert
Published on 2008-08-23T03:46:32Z
Indexed on
2010/06/11
23:52 UTC
Read the original article
Hit count: 290
I want to see all the different ways you can come up with, for a factorial subroutine, or program. The hope is that anyone can come here and see if they might want to learn a new language.
Ideas:
- Procedural
- Functional
- Object Oriented
- One liners
- Obfuscated
- Oddball
- Bad Code
- Polyglot
Basically I want to see an example, of different ways of writing an algorithm, and what they would look like in different languages.
Please limit it to one example per entry. I will allow you to have more than one example per answer, if you are trying to highlight a specific style, language, or just a well thought out idea that lends itself to being in one post.
The only real requirement is it must find the factorial of a given argument, in all languages represented.
Be Creative!
Recommended Guideline:
# Language Name: Optional Style type - Optional bullet points Code Goes Here Other informational text goes here
I will ocasionally go along and edit any answer that does not have decent formatting.
© Stack Overflow or respective owner