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
Write about c++ storage classes?
Is there any difference between int [] a and int a [] in c++?
What are the types of pointer?
What is the difference between structure and class?
What are the four partitions in which c++ compiler divides the ram?
Define macro.
What are the types of array in c++?
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?
What are structures and unions?
What is c++ stringstream?
What is c++ & why it is used?
What is a rooted hierarchy?
Define token in c++.
What is the use of default constructor?
Explain rethrowing exceptions with an example?