0

HELP! with a simple code

Hello everyone! I can't find the correct code for a simple thing: INVERT A NUMBER with RECURSION, using a function, on C++, if someone can help me, I will be so grateful. Pd: I want to get the value of the invert number, not just show it THANKS!

20th Jul 2018, 1:59 AM
ElĂ­as Mauricio EspĂ­nola
ElĂ­as Mauricio EspĂ­nola - avatar
4 RĂ©ponses
+ 1
Where is your attempted code?
20th Jul 2018, 2:26 AM
$±𝐎â‚č𝔭!𝐹𝓝
$±𝐎â‚č𝔭!𝐹𝓝 - avatar
0
int invertir (int n){ if (n<10) return n; else { return invertir (n/10); } }
20th Jul 2018, 2:29 AM
ElĂ­as Mauricio EspĂ­nola
ElĂ­as Mauricio EspĂ­nola - avatar
0
If you pass any number to it, It'll return 0. Because the function throws first dight away at "n / 10".
20th Jul 2018, 4:59 AM
Disvolviĝo;
Disvolviĝo; - avatar
0
Thank you Robin! You'd been very helpful! Thanks! Your code works perfectly! đŸ’ȘđŸ’ȘđŸ’Ș
20th Jul 2018, 12:01 PM
ElĂ­as Mauricio EspĂ­nola
ElĂ­as Mauricio EspĂ­nola - avatar