#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int DP[100];

int fac(int n){
    if(n<=1)
        return n;

    if(DP[n] != -1)
        return DP[n];

    DP[n] = n * fac(n - 1);

    return DP[n];
}

int main() {
    int num;
    scanf("%d", &num);

    for(int i=0; i<100; i++){
        DP[i] = -1;
    }

    printf("%d", fac(num));
    
    return 0;
}

Embed on website

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