Help in code... Needs a desired update in a function though already works!😂for a PALINDROME number | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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😐

18th Dec 2020, 1:45 PM
Dastien Danshov
4 Answers
+ 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
21st Dec 2020, 10:10 AM
zemiak
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
19th Dec 2020, 5:30 PM
zemiak
0
Sorry, but not using of a loop is a specification here
21st Dec 2020, 5:33 AM
Dastien Danshov
0
Thanks
8th Jan 2021, 4:26 AM
Dastien Danshov