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!
4 ответов
+ 1
Where is your attempted code?
0
int invertir (int n){
if (n<10)
return n;
else {
return invertir (n/10);
}
}
0
If you pass any number to it, It'll return 0.
Because the function throws first dight away at "n / 10".
0
Thank you Robin! You'd been very helpful! Thanks! Your code works perfectly! 💪💪💪