Exercise #1
Factorials can be computed recursively or non-recursively.
Write two functions that both compute factorials. One should do it
recursively, and the other by iterations. Your program should prompt
the user for a number and you should output the results of both of the
functions. (which should be the same)
(5 factorial is 5*4*3*2*1. Zero factorial is, by definition, equal to 1)
Exercise #2
Write a recursive function to test for a palindrome. A palindrome is a
string that reads the same forwards or backwards, such as "MADAM" and
"ABCDCBA". Your program should prompt the user for a word and output whether
it is a palindrome or not.
Hint: use three parameters to the function: the string (character array)
itself, the starting index and the ending index. Thus, a call such as
palindrome("abcddcbh",1,6) would only check the string between
indices 1 and 6 inclusive (i.e. "bcddcb"). This will allow the recursive
call to be formulated easier.