C Program To Check Number Is Palindrome Or Not

C Program To Check Number Is Palindrome Or Not

Code
// WAP To Check Number Is Palindrome Or Not...

#include <stdio.h>
int main()
{
    int num, digit, rev = 0, temp;
    printf("Enter Number:\n");
    scanf("%d", &num);
    temp = num;
    while (num != 0)
    {
        digit = num % 10;
        num = num / 10;
        rev = (rev * 10) + digit;
    }
    if (rev == temp)
    {
        printf("The Number Is Palindrome.");
    }
    else
    {
        printf("The Number Is Not Palindrome.");
    }

    return 0;
}
Output
Enter Number:
7865687
The Number Is Palindrome.

Post a Comment