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

Write about c++ storage classes?

740


Is there any difference between int [] a and int a [] in c++?

543


What are the types of pointer?

544


What is the difference between structure and class?

549


What are the four partitions in which c++ compiler divides the ram?

694






Define macro.

581


What are the types of array in c++?

616


If we want that any wildcard characters in the command line arguments should be appropriately expanded, are we required to make any special provision? If yes, which?

996


What are structures and unions?

565


What is c++ stringstream?

599


What is c++ & why it is used?

583


What is a rooted hierarchy?

673


Define token in c++.

710


What is the use of default constructor?

567


Explain rethrowing exceptions with an example?

604