C Program to Check Whether a Number is Palindrome Number or not

In this program, you'll learn to check a given number is Palindrome number or not. A palindrome number is a number that is same after reverse. For example 121, 34543, 343, 131, 48984 are the palindrome numbers. To check if a number is palindrome or not follow below steps: 1) Declare two variables: one stores the given number, and the other stores the reversed number. 2) Run the while loop until the number is greater than zero. 3) Check if the reversed number is equal to the given number.

Source Code
void main()
    int num, original, rev=0, digit, i;
    printf("Enter the number: ");
    scanf("%d", &num);
    original = num;
    i = 1;
    while(num > 0)
        digit = num%10;
        rev = rev*10 + digit;
        num = num/10;
    if(original == rev)
        printf("Number is palindrome");
        printf("Number is not palindrome");
Enter the number: 123
Number is not palindrome

Enter the number: 12321
Number is palindrome