write program for palindrome
Answer Posted / purnachandra sahoo
/*Program to check whether a number is palindrom or not*/
#include<iostream.h>
#include<conio.h>
int pall(int);
void main()
{
int n,res;
clrscr();
cout<<"Enter the number :";
cin>>n;
res=pall(n);
cout<<" which is:"<<res;
getch();
}
int pall(int x)
{
int p,a,sum=0;
p=x;
while(x!=0)
{
a=x%10;
sum=sum*10+a;
x=x/10;
}
if(sum==p)
{
cout<<"\nThe enterd number is palindrom" ;
return(sum);
}
else
{
cout<<"\nThe entered number is not palindrom" ;
return 0;
}
}
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
If dog is a friend of boy and boy is a friend of house, is dog a friend of house?
Explain explicit container.
What is an html tag?
What is extern c++?
How to give an alternate name to a namespace?
What is unary operator? List out the different operators involved in the unary operator.
Show the declaration for a static function pointer.
What do you understand by a pure virtual member function?
why is iostream::eof inside a loop condition considered wrong?
You have two pairs: new() and delete() and another pair : alloc() and free(). Explain differences between eg. New() and malloc()
What is the best book for c++ beginners?
what are the iterator and generic algorithms.
What are the steps in the development cycle?
What is a lambda function c++?
What is scope operator in c++?