The factorial of a number is the product of that number multiplied by every number less than it, going down…