Write a program to check whether a number is palindrom or not.

#include<stdio.h>
main()
{
    int num,rev=0,rem,temp;
    printf("\nEnter a number=");
    scanf("%d",&num);
    temp=num;
    while(num)
    {
        rem=num%10;
        rev=rev*10+rem;
        num/=10;
    }
    if(temp==rev)
        printf("\n %d is a palindrom number",temp);
    else
        printf("\n %d is not a palindrom number",temp);
}

No comments:

Post a Comment