Calculates factorial of a number.
Tests factorial calculation.
Tests problem 24.