C - A2P1 - Check if a number is Palindrome or Not




// Write a Programe to check whether the Number is Palindrome or Not

#include<stdio.h>
#include<conio.h>
void main()
{
    int num,a,rnum=0,temp;
    clrscr();
    printf("Enter Any Number ->");
    scanf("%d",&num);
    temp=num;
    for(num=temp; num>0; num=num/10)
    {
        a=num%10;
        rnum=(rnum*10) + a;
    }

    if(temp==rnum)
    {
        printf("\nIt is a Palindrome Number");
    }
    else
    {
        printf("\nIt is Not a Palindrome Number");
    }
    getch();
}

Post a Comment