Pergunta de entrevista da empresa PAE

I was asked to write sample code, one to test for proficiency with basic coding (if statements using modulus) and the other was with recursion.