Last active
October 12, 2019 09:38
-
-
Save lasagnaphil/aed9b255c08b4becab73660d9c1e7f13 to your computer and use it in GitHub Desktop.
factorial.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int factorial(int n) { | |
if (n == 0) return 1; | |
else return n * factorial(n - 1); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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