#include <stdio.h>

int fact(int n)
{
    if (n == 1){
        return 1;
    }
    else{
        return n *fact(n-1);
    }
}

int main() {
    int n;
    printf("\nenter the number for factorial: ");
    scanf("%d",&n);
    printf("\nthe factorial of %d is %d",n,fact(n));
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: