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
Explain about vectors in c ++?
Why would you use pointers in c++?
Explain the difference between static and dynamic binding of functions?
What is enum class in c++?
What is vector pair in c++?
Difference between inline functions and macros?
What is the use of this pointer in c++?
Which one between if-else and switch is more efficient?
Write some differences between an external iterator and an internal iterator? Describe the advantage of an external iterator.
What is vector string in c++?
What is #include sstream?
Differentiate between structure and class in c++.
What jobs can you get with a c++ certification?
What are disadvantages of pointers?
Explain the use of vtable.