write program for palindrome
Answer Posted / gaurav joshi
#include <stdio.h>
int main()
{
int number,temp,remainder,sum=0;
printf("nnEnter no: ");
scanf("%d",&number);
temp = number; //Value of temp stores unmodified n value
while(number>0)
{
remainder=number%10;
number/=10;
sum=sum*10 + remainder; //Builds value of reversed number
}
if (sum==temp)
printf ("nThe Number Is A Palindrome ");
else
printf ("nThe Number Is Not A Palindrome ");
getch ();
return 0;
}
| Is This Answer Correct ? | 4 Yes | 0 No |
Post New Answer View All Answers
What happens if a pointer is deleted twice?
What can I use instead of namespace std?
What is the use of endl in c++?
Are there any special rules about inlining?
What is data hiding c++?
What is c++ used for in games?
Explain what are single and multiple inheritances in c++?
What is an arraylist c++?
Comment on c++ standard exceptions?
When are exception objects created?
How the keyword struct is different from the keyword class in c++?
What is array in c++ pdf?
What is pointer in c++ with example?
What is difference between array and vector in c++?
How is computer programming useful in real life?