#include <stdio.h>

int ft_iterative_factorial(int nb){
    int i = 1;
    int result = 1;

    if(nb < 0)
        return 0;
        
    else if(nb == 1 || nb == 0)
        return 1;
    
    while (i <= nb){
        result = result * i;
        i++;
        
    }return result;    
}

int main() {
    int a = ft_iterative_factorial(-2);
    
    printf("%d", a);
    return 0;
}

Embed on website

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