Program to check given number is palindrome number or not - C Program

Program to check given number is palindrome number or not

A palindrome number is a number that is same after reverse. For example 545, 171 are the palindrome

#include <stdio.h>
int main()
{
   int num, n, rev_no=0,r;
    printf("Enter the number :");
    scanf("%d",&num);
    n = num;
    while(n!=0)
    {
        r = n % 10;
        rev_no = rev_no*10+r;
        n = n / 10;
    }
    if (num == rev_no)
        printf("Given number %d is palindrome number", num);
    else
        printf("Given number %d is not a palindrome number", num);
    return 0;
}

Output - Program to check given number is palindrome number or not

Enter the number :454                                                                                                 
Given number 454 is palindrome number   
Compile and Run Online