Calculates factorial of a number and the number of permutations and combinations of n things taken r at a time.