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
Can a list of string be stored within a two dimensional array?
What is exception handling? Does c++ support exception handling?
Describe public access specifiers?
Is ca high or low level language?
Difference between a homogeneous and a heterogeneous container
What is the difference between multiple and multilevel inheritance in c++?
Why do we use setw in c++?
Write a program to add three numbers in C++ utilizing classes.
Explain function overloading and operator overloading.
Define the process of handling in case of destructor failure?
How is c++ different from java?
What does the following do: for(;;) ; a) Illegal b) Loops forever c) Ignored by compiler...not illegal
What is overloading unary operator?
What is virtual destructor ans explain its use?
What is the difference between structure and class?