0

Reverse of digit

e.g. input 12345 output 54321

23rd Oct 2017, 6:23 AM
Victoria Kim
Victoria  Kim - avatar
2 Respostas
23rd Oct 2017, 6:57 AM
Dragon Slayer Xavier
Dragon Slayer Xavier - avatar
+ 2
Check this: #include <iostream> using namespace std; int main() { int n; cin >> n; while (n > 0) { cout << n % 10; n /= 10; } return 0; } Note: It works only for 32 bit numbers.
23rd Oct 2017, 7:36 AM
Boris Batinkov
Boris Batinkov - avatar