// 11. Calculate the factorial of N using a recursive function
#include <stdio.h>

long long factorial(int n) {
    if (n == 0 || n == 1) {
        return 1;                       // base case
    }
    return n * factorial(n - 1);        // recursive call
}

int main() {
    int n;

    printf("Enter a number: ");
    scanf("%d", &n);

    if (n < 0) {
        printf("Factorial of a negative number does not exist\n");
    } else {
        printf("Factorial of %d = %lld\n", n, factorial(n));
    }

    return 0;
}
