printWords(n/10); ???
int digit = n%10; ????
cout << words[digit]<<" "; ?????
Not understand whole solution
hello @amit0001
first understand this .
a)
if number is 1234 then 1234/10 = 123 (ie dividing by 10 will remove right most digit from the number).
b) if number is 1234 then 1234%10= 4 (ie taking mod with 10 ,will give right most digit of the number)
now come to recusion .
we receive a number N.
we remove rightmost digit and call recusion on remaining numbers
after that once the execution of subproblem is done we print the right most digit.
why we take a 2D array?
it is for storing words.
the words are stored something like this->
thats why we need 2d array.
okay thank you
I mark as resolve
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.