// Palindrome Problem.
#include<iostream> using namespace std;
int main() { long num; int arr[10],n=1,mod,c=0,j;
cout<<"\n\t\t\tIS NUMBER PALINDROME\n"; cout<<"Enter any Number :\t";cin>>num; while(num!=0) { mod=num%10; num/=10; arr[n]=mod; n++; }
for(int i=1,j=n-1;i<=(n)/2;i++) { if(arr[i]==arr[j]) j--; else c++; } if(c!=0) cout<<"\n\t\t....Not Palindrome....\n\n"; else cout<<"\n\t\t....Palindrome....\n"; cout<<"\n\n"; system("pause"); return 0; }
Palindrome Number Program in C++
ReplyDeleteA Palindrome number is a number that remains the same when its digits are reversed. Like 16461, for example: we take 121 and reverse it, after revers it is same as original.