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
Difference between a copy constructor and an assignment operator.
Does a derived class inherit or doesn't inherit?
Can you be able to identify between straight- through and cross- over cable wiring? And in what case do you use straight- through and cross-over?
How are pointers type-cast?
Is c++ a low level language?
Can malloc be used in c++?
Explain the term memory alignment?
Explain differences between alloc() and free()?
What are the three forms of cin.get() and what are their differences?
Is there any difference between int [] a and int a [] in c++?
What is singleton class in c++?
What is a binary file? List the merits and demerits of the binary file usagein C++.
What is the extension of c++?
Explain rethrowing exceptions with an example?
Define friend function.