Looks like a homework question. Did you try to find basic information regarding your assignment and did try to approach it yourself? There's a lot of information about recursion on the internet, nothing should stop you from making an attempt if you want to lean. Please see softwareengineering.meta.stackexchange.com/questions/6166/… — Alexander Ivanchenko19 secs ago