Write two recursive integer
functions. The first function should calculate factorials
using the definition 0! = 1 and n! = (n-1)! x n. In
addition, if n is too large it should be able to detect
integer overflow before it happens. The next function
should calculate the greatest common factor (gcf) of two
numbers. If the second number is zero, then the gcf is
the other number. Otherwise, the gcf of a and b is the
same as the gcf of b and a mod b.
Comments
Leave a comment