formula for factorial of number code example Example: factorial formula factorial formula n! = n * ( n - 1 ) *...*1