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 a pointer how and when is it used?
State the difference between delete and delete[].
Why do we use classes in c++?
Where Malloc(), Calloc(), and realloc() does get memory?
What is the use of 'this' pointer?
What is low level language in simple words?
What return value must conversion operators have in their declaration?
What happens when the extern "c" char func (char*,waste) executes?
State two differences between C and C++.
How would you find out if a linked-list is a cycle or not?
Write a function to perform the substraction of two numbers. Eg: char N1="123", N2="478", N3=-355(N1-N2).
what are Operators and explain with an example?
What is const pointer and const reference?
What is the difference between equal to (==) and assignment operator (=)?
Difference between pass by value and pass by reference?