How do I reverse decimal number. I wrote this code but reverses the integer.
#include <stdio.h>
#include <conio.h>
#include <iostream>
#include <math.h>
long reverse(long);
int main()
{
long n, r;
scanf("%ld", &n);
r = reverse(n);
printf("%ld\n", r);
getch();
return 0;
}
long reverse(long n)
{
static long r = 0;
if (n == 0)
return 0;
r = r * 10;
r = r + n % 10;
reverse(n/10);
return r;
}
I can not separate the integer of the decimal.
How should I do it.