write program for palindrome
Answer Posted / noor alam khan
#include<iostream.h>
#include<conio.h>
main()
{
int n, reverse = 0, temp;
cout<<"Enter a number to check if it is a palindrome or
not\n"<<endl;
cin>>n;
temp = n;
while( temp != 0 )
{
reverse = reverse * 10;
reverse = reverse + temp%10;
temp = temp/10;
}
if ( n == reverse )
cout<<n<<" is a palindrome number \n"<<endl;
else
cout<<n<<"is not a palindrome number"<<endl;
return 0;
}
| Is This Answer Correct ? | 0 Yes | 3 No |
Post New Answer View All Answers
What is the difference between strcpy() and strncpy()?
What are the two shift operators and what are their functions?
Is swift a good first language?
What is scope resolution operator in c++ with example?
Describe the advantages of operator overloading?
Can I learn c++ as my first language?
What is the best c++ book?
When are exception objects created?
What is a local reference?
How many types of classes are there in c++?
How do you find out if a linked-list has an end?
What do you understand by pure virtual function? Write about its use?
What is an html tag?
Why was c++ made?
Can I learn c++ in a week?