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
Difference between pointer to constant and constant pointer to a constant. Give example.
Explain the benefits of proper inheritance.
Do class declarations end with a semicolon? Do class method definitions?
Mention the storage classes in c++.
What are references in c++? What is a local reference?
What do you mean by function overriding & function overloading in c++?
What is called array?
What is &x in c++?
Do you know what are pure virtual functions?
Give an example of run-time polymorphism/virtual functions.
What is the use of 'using' declaration in c++?
Write an algorithm that determines whether or not an almost complete binary tree is a heap.
Write a code/algo to find the frequency of each element in an array?
Explain the difference between realloc() and free() in c++?
What do manipulators do?