こんなんでいい?
#include <iostream>
int main(){
int val;
std::cin>>val;
if(val<0) return 0;
do{
std::cout<<val%10;
val/=10;
}while(val!=0);
return 0;
}