C Program to Reverse Number Using Recursive Function

Question: Write a program in C to find reverse of a given integer number using recursive function (recursion).

Reversing Number Using Recursion in C


int reverse(int , int );

int main()
    int number, result;
    printf("Enter number: ");
    scanf("%d", &number);
    /* Second argument must be 0 while calling function */
    result = reverse(number, 0);

    printf("Reverse of %d is %d.", number, result);
    return 0;

int reverse(int num, int rev)
        return rev;
        return reverse (num/10, rev*10 + num%10);


Enter number: 1234
Reverse of 1234 is 4321.