Monday, July 22, 2013

Program to check whether a number is palindrome or not

A palindromic number is a number that remains the same when its digits are reversed.



#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int i,n,a=0,d;
cout<<"Enter the number ";
cin>>n;
i=n;
while(n>0)
{
    d=n%10;
    n=n/10;
    a=a*10+d;
}
if(ans==i)
    cout<<"Number is a Palindrome ";
else
    cout<<"Number is not a Palindrome ";
getch();
}

1 comment: