Tuesday, 10 January 2012

Palindrome Number Checking

#include<stdio.h>
#include<conio.h>

void main()
{
    int n,num,reverse=0;
    clrscr();
    printf("Enter the number::\n");
    scanf("%d",&n);
    num=n;
    while(num!=0)
    {
        reverse=reverse*10;
        reverse=reverse+num%10;
        num=num/10;
    }
    if(reverse==n)
    {
        printf("This is Palindrome::");
    }
    else
    {
        printf("This is not Palindrome::");
    }
    getch();
}

No comments:

Post a Comment