C Programming Code Examples C > Recursion Code Examples C Program to find Reverse of a Number using Recursion C Program to find Reverse of a Number using Recursion The following C program using recursion reverses the digits of the number and displays it on the output of the terminal.Eg: 396 becomes 693. #include <stdio.h> #include <math.h> int rev(int, int); int main() { int j, result; int length = 0, temp; printf("Enter an integer number to reverse: "); scanf("%d", &j); temp = j; while (temp != 0) { length++; temp = temp / 10; } result = rev(j, length); printf("The reverse of %d is %d.\n", j, result); return 0; } int rev(int j, int len) { if (len == 1) { return j; } else { return (((j % 10) * pow(10, len - 1)) + rev(j / 10, --len)); } }