Recursion (Questions)
Q. Given two numbers p & q, find the value p^q using a recursive function.
Q
In this case, we have to think that 12,24,36,48 are already printed by recursion, now what should we do, we have to just print 12*5=60. i.e num*k. The base case is the smallest sub-problem when we have to print 12 only one time i.e. k=1, In that case, we just print that number and return.
Q. Given a number n. Find the sum of natural numbers till n but with alternate signs
Q. Find GCD using recursion.
First approach
Second approach (Euclidean algorithms)