Wednesday, 25 May 2016
Check Given Number Is Palindrome Or Not
Check Given Number Is Palindrome Or Not
Palindrome Number Means
If We write a Number
For Example : 121
This Is Palindrome Because
If We Reverse It Their Is No Change In It
Output :
CodeIs Given Blow
Click On Read More
#include<iostream>
using namespace std;
int main()
{
int palindrome ,reverse=0,num;
cout<<"Enter Palindrome number =";
cin>>palindrome;
int key =palindrome;
for(int i=1; palindrome!=0; i++)
{
num=palindrome%10;
palindrome=palindrome/10;
reverse=num+(reverse*10);
}
if(reverse==key)
{
cout<<"Given Number Is Palindrome";
}
else
{
cout<<"Given Number Is not Palindrome";
}
}
Labels:
Cplusplus Programs
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment