1.Write the recursive function Factorial. This function will receive an integer value that is O or greater and will return the factorial of that number. For example,
4 ! = 4 * 3 * 2 * 1.
Factorial
is defined recursively as
N ! (i.e.,
n
factorial)= N * (N-1) ! for N >= 1
O ! (i.e., "O factorial") = 1
Show the stack trace as it exists at its tallest point when it is called by Factorial ( 5).
2. Write the recursive function GCD (for greatest common divisor). The function will receive two integer values and will return the largest integer that can be divided evenly into both numbers . GCD is defined recursively as:
GCD of two integers (x , y) is x if y = 0.
GCDoftwointegers (x , y) isGCD(y, x MOD y) ify 0
Show the stack as it exists at its tallest point when GCD is called by GCD ( 3 5 ,
149) .
3.Declare a record type called Class_Grade that will hold the following information
about a students grade in a class:
• Lab average (a number).
• Homework average (a number).
• Quiz average ( a number).
• Whether or not current grade is passing (a boolean).