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


Please Help Members By Posting Answers For Below Questions

Can a list of string be stored within a two dimensional array?

569


What is exception handling? Does c++ support exception handling?

583


Describe public access specifiers?

575


Is ca high or low level language?

580


Difference between a homogeneous and a heterogeneous container

657






What is the difference between multiple and multilevel inheritance in c++?

588


Why do we use setw in c++?

635


Write a program to add three numbers in C++ utilizing classes.

614


Explain function overloading and operator overloading.

615


Define the process of handling in case of destructor failure?

568


How is c++ different from java?

557


What does the following do: for(;;) ; a) Illegal b) Loops forever c) Ignored by compiler...not illegal

691


What is overloading unary operator?

593


What is virtual destructor ans explain its use?

597


What is the difference between structure and class?

546