+ 5

How to reverse a number WITHOUT using loops...

Only C and C++ accepted... Remember loops are Restricted...

12th Jan 2018, 4:48 PM
Lord Of Victory...
Lord Of Victory... - avatar
5 Answers
+ 24
u can use recursion also
12th Jan 2018, 5:27 PM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 11
use strrev() function in C😊
12th Jan 2018, 5:27 PM
Jaydeep Khatri
Jaydeep Khatri - avatar
+ 8
Using reverse() function, e.g. int main() { string str = "1234"; reverse(str.begin(),str.end()); cout << str; return 0; }
12th Jan 2018, 5:17 PM
Lakshay
Lakshay - avatar
+ 7
yeah recursive function is best !
12th Jan 2018, 5:30 PM
Aditya
Aditya - avatar
+ 4
Maybe convert string to char array and then use the reverse method. From there just convert back to string. Granted not good for memory management with the use of multiple strings, but better than nothing.
12th Jan 2018, 5:09 PM
josh mizzi
josh mizzi - avatar