+ 5
How to reverse a number WITHOUT using loops...
Only C and C++ accepted... Remember loops are Restricted...
5 Answers
+ 24
u can use recursion also
+ 11
use strrev() function in Cđ
+ 8
Using reverse() function,
e.g.
int main()
{
string str = "1234";
reverse(str.begin(),str.end());
cout << str;
return 0;
}
+ 7
yeah recursive function is best !
+ 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.