factorial returns the factorial of a nonnegative integer n, denoted by n!, the product of all positive integers less than or equal to n. For example, 5!=5x4x3x2x1
factorial(int x)