Skip to content

Instantly share code, notes, and snippets.

@jatinsharrma
Created March 31, 2019 12:47
Show Gist options
  • Save jatinsharrma/1c35aa73b0fb62bc0a18e63680148265 to your computer and use it in GitHub Desktop.
Save jatinsharrma/1c35aa73b0fb62bc0a18e63680148265 to your computer and use it in GitHub Desktop.
Factorial using recursion
#include <stdio.h>
int fact(int a){
if (a == 0){
return 1;
}
else{
return a * fact(a-1);
}
}
void main(){
int a=10;
a = fact(a);
printf("%d",a);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment