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
What is c++ namespace?
Where is atoi defined?
How much is c++ certification?
What is a local variable?
What is a tuple c++?
Comment on local and global scope of a variable.
Write a program in C++ for Fibonacci series
Can we make any program in c++ without using any header file and what is the shortest program in c++.
What are the advantages of pointers?
Is there a c++ certification?
Differentiate between the message and method in c++?
Briefly describe a B+ tree. What is bulk loading in it?
What is the difference between public and private data members?
How to implement is-a and has-a class relationships?
How delete [] is different from delete?