We had done increasing-decreasing recursion and in that n is decreasing its value by 1 in recursive case then why in the above program it is not decreasing its value by doing n/10?
Why it is not decreasing its value by doing n/10?
Hey if you mean why here n is not decreasing
printspelling(n/10);
int digit=n%10;
Here n is not decreasing because we are not assigning changes to n in current call of printspelling
we are calling printspellin(n/10) which means n/10 is passed as argument to next call but in current call it will remain n because we haven’t done like this n=n/10; printspelling(n);
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.