Skip to content

Instantly share code, notes, and snippets.

@lasagnaphil
Last active October 12, 2019 09:38
Show Gist options
  • Save lasagnaphil/aed9b255c08b4becab73660d9c1e7f13 to your computer and use it in GitHub Desktop.
Save lasagnaphil/aed9b255c08b4becab73660d9c1e7f13 to your computer and use it in GitHub Desktop.
factorial.c
int factorial(int n) {
if (n == 0) return 1;
else return n * factorial(n - 1);
}
#include <stdio.h>
int factorial(int n);
int main(void) {
int n;
scanf("%d", &n);
printf("%d", factorial(n));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment