C Programming Code Examples C > Mathematics Code Examples C Program to check if a number is palindrome or not C Program to check if a number is palindrome or not If a number remains same, even if we reverse its digits then the number is known as palindrome number. For example 10201 is a palindrome number because it remains same if we reverse its digits. In this article we have shared two C programs to check if the input number is palindrome or not. 1) using while loop 2) using recursion. /* Program to check if a number is palindrome or not * using while loop */ #include <stdio.h> int main() { int num, reverse_number=0, remainder,temp; printf("Enter an integer: "); scanf("%d", &num); /* Here we are generating a new number (reverse_number) * by reversing the digits of original input number */ temp=num; while(temp!=0) { remainder=temp%10; reverse_number=reverse_number*10+remainder; temp/=10; } /* If the original input number (num) is equal to * to its reverse (reverse_number) then its palindrome * else it is not. */ if(reverse_number==num) printf("%d is a palindrome number",num); else printf("%d is not a palindrome number",num); return 0; }