i have to reverse the position of integer like this
input = 12345
output = 54321
i made this but it gives wrong output e.g 5432
#include
Here is a solution
int num = 12345; int new_num = 0; while(num > 0) { new_num = new_num*10 + (num % 10); num = num/10; } cout << new_num << endl;