Program to Find Whether a Number is Palindrome or Not in C

Find Whether a Number is Palindrome or Not

#include <stdio.h>
main()
{
         int n, pal=0, temp, x;
         printf(" Enter any number: ");
         scanf("%d", &n);
         temp = n;
         while (temp > 0)
         {
                  x = temp%10;
                  temp = temp/10;
                  pal = pal*10 + x;
         }

         if (pal == n)
         printf(" %d is palindrome", n);
 
         else
         printf(" %d is not palindrome", n);
         getch();
}