May be this is what you're looking for. Considering that if you give negative number -4563 the output should be -3645. The coding style is bit old and it doesn't use namespace. How it's just a guideline for you.
Code:#include <iostream.h>
int rev(int n)
{
static int rev_num=0,zero_num=0;
if(n)
{
if(n<0)
{
zero_num=1;
rev(n*-1);
}
else
{
rev_num=(rev_num*10)+n%10;
rev(n/10);
}
}
else
{
if(zero_num==1)
rev_num*=-1;
return rev_num;
}
}
int main()
{
int n;
cout<<"\n\nEnter The Number :";
cin>>n;
cout<<"The Reverse Of Num is :"<<rev(n);
return 0;
}

