#include <stdio.h>
int fact(int n);
int main() {
printf("factorial is %d\n",fact(7));
return 0;
}
int fact(int n){
if (n==0){ //this is a base case (which is necessary) wich stops the condition
return 1;
}
int factNm1 = fact(n-1);
int factN =factNm1 * n;
return factN;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: