HW21
COP-3223H
Submit via webcourses.
Using the pattern shown for sums in class, write five functions,
exponent5,exponent4,exponent3,exponent2,exponent1, that call each other to compute the power of a number. For instance, callingexponent3(2)will compute2to the power of3, i.e.,2^3or8.Note: be sure to putchar a newline character
\nafter printing the sprite to ensure the output buffer is flushed.- Write a recursion version of
int exponent(int x, int e)that returns \(x^e\) for \(x >= 0\) and \(e >= 0\).