The function magicfun() recursively calculates the binary representation of the input number n. When called with inputs 7 and 10, it returns 111 and 1010 respectively by recursively dividing n by 2 and adding the remainders. The function Check() recursively calls itself, decrementing n each time and incrementing/decrementing m. When called with both inputs equal to 5, it returns 21 by recursively processing the inputs in the described manner.
Download as DOCX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
16 views
Recursion Document
The function magicfun() recursively calculates the binary representation of the input number n. When called with inputs 7 and 10, it returns 111 and 1010 respectively by recursively dividing n by 2 and adding the remainders. The function Check() recursively calls itself, decrementing n each time and incrementing/decrementing m. When called with both inputs equal to 5, it returns 21 by recursively processing the inputs in the described manner.