Skip to content

Instantly share code, notes, and snippets.

@ming2540
Created August 31, 2018 11:31
Show Gist options
  • Save ming2540/be5390a2fe1e1892ca6d57927d640e01 to your computer and use it in GitHub Desktop.
Save ming2540/be5390a2fe1e1892ca6d57927d640e01 to your computer and use it in GitHub Desktop.
#include<stdio.h>
int factorial(int n){
if(n==1)
return 1;
else
return n * factorial(n-1);
}
int main(){
printf("factorial of 5 is %d",factorial(5));
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment