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
Write a function to perform the substraction of two numbers. Eg: char N1="123", N2="478", N3=-355(N1-N2).
What are iterators in c++?
Explain the properties and principles of oop.
Explain how would you handle a situation where you cannot call the destructor of a local explicitly?
What is a vector c++?
What are the types of pointer?
What is the difference between equal to (==) and assignment operator (=)?
What does it mean to declare a member variable as static?
What is a try block?
Is c++ a programming language?
What is the use of ::(scope resolution operator)?
What are c++ templates used for?
Can a Structure contain a Pointer to itself?
How do we implement inheritance in c++?
What is c++ used for in games?