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


Please Help Members By Posting Answers For Below Questions

What is a pointer how and when is it used?

791


State the difference between delete and delete[].

780


Why do we use classes in c++?

798


Where Malloc(), Calloc(), and realloc() does get memory?

810


What is the use of 'this' pointer?

1012


What is low level language in simple words?

791


What return value must conversion operators have in their declaration?

810


What happens when the extern "c" char func (char*,waste) executes?

844


State two differences between C and C++.

806


How would you find out if a linked-list is a cycle or not?

730


Write a function to perform the substraction of two numbers. Eg: char N1="123", N2="478", N3=-355(N1-N2).

804


what are Operators and explain with an example?

925


What is const pointer and const reference?

813


What is the difference between equal to (==) and assignment operator (=)?

774


Difference between pass by value and pass by reference?

838