Look in Base case of function num, i am returning the sum to main function. It is printing correct value before returning statement.
Recursion- returning wrong value of sum variable
@priyeshc23
Yes because your function was not returning the value to its previous function call. It only returned in the base case.
Base case returned the value to its previous function call, but that function call did not returned that to its previous and so on to the main function.