Recursive program to check if number is palindrome or not | Recursive C # program to check if the number is palindrome or not ; recursive function that returns the reverse of digits ; base case ; stores the reverse of a number ; Driver Code
using System ; class GFG { static int rev ( int n , int temp ) { if ( n == 0 ) return temp ; temp = ( temp * 10 ) + ( n % 10 ) ; return rev ( n / 10 , temp ) ; } public static void Main ( ) { int n = 121 ; int temp = rev ( n , 0 ) ; if ( temp == n ) Console . WriteLine ( " yes " ) ; else Console . WriteLine ( " no " ) ; } }