+ 1
Help in code... Needs a desired update in a function though already works!😂for a PALINDROME number
The reverse()function in the attached code with specifications: no use of revnum variable(or such)or loop and no use of string and the function signature should remain intact Necessarily should be a recursive function https://code.sololearn.com/cQmSL8rWOyA7/?ref=app Sorry for the lack of comments😐
4 Antworten
+ 1
ok instead of loop (to find the length of the number) use
log10(n)
or many
if (n>=100_000) .. else if (n>=10_000) ...
or write intLength( n ) as recursive method
0
{
y = 1234_5
int revnum = reverse(1234) // 4321
in loop
4321
432
43
4
// (4x)
return 5*10000 +4321
}
end of recursion if y is only one digit
0
Sorry, but not using of a loop is a specification here
0
Thanks