Skip to content

Instantly share code, notes, and snippets.

@felipernb
Created October 22, 2012 18:53
Show Gist options
  • Save felipernb/3933368 to your computer and use it in GitHub Desktop.
Save felipernb/3933368 to your computer and use it in GitHub Desktop.
Factorial in C
long recurFact(int n) {
if (n == 0) return 1L;
return n * recurFact(n-1);
}
long iterFact(int n) {
long fact = 1;
for (; n > 1; n--) fact *= n;
return fact;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment