Recent Posts

Wednesday, 1 October 2014

simplest palandrom program

#include<iostream>
int main(){
    int num,x,sum=0,temp;
    cout << "Enter a number: ";
     cin >> num;
    for(temp=num;num!=0;num=num/10){
         x=num%10;
         sum=sum*10+x;
    }
    if(temp==sum)
         cout << temp << " is a palindrome";
    else
         cout << temp << " is not a palindrome";
    return 0;
}

0 comments: