0

Ok well I got a final tomorrow and for the life of me I can not understand recursion. I have tried and tried and no hope lol. The professor gave us a study guide and I cant not figure out 2 problems. Just wondering if anyone can help me before I take this Final tomorrow. Thanks in advance.

(a) Write and test a recursive function that prints the extreme characters on separate lines. For

example: a parameter of “IMAGINE” It would print:

IE

MN

AI

G

(b) Write a Recursive function that given an integer n computes and returns the sum of the first even

integers less than or equal to n. For example: n=10, it would compute and return 2+4+6+8+10. For

n=11, it would compute and return 2+4+6+8+10.

for (b) I tried it. I got something along the lines of

```
int a(int n)
{
if(n<=0)
return 0;
else
if(n%2==0)
return n+a(n-2)
}
```