write program for palindrome
Answer Posted / prashant gupta
//in C Language
#include <stdio.h>
#include <conio.h>
int main()
{
int number,temp,remainder,sum=0;
printf("\n\nEnter no: ");
scanf("%d",&number);
temp = number; //Value of temp stores unmodified n value
while(number>0)
{
remainder=number%10; //Gets Last Digit
number/=10; //Truncates Last Digit
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 ? | 1 Yes | 0 No |
Post New Answer View All Answers
What is type of 'this' pointer?
What does n mean in c++?
What is #include iostream h in c++?
why and when we can declar member fuction as a private in the class?
What are c++ tokens?
What is private, public and protected inheritance?
What is the best c++ book?
Can we sort map in c++?
What are proxy objects in c++?
What is #include ctype h in c++?
What is a storage class? Mention the storage classes in c++.
What is encapsulation in c++ with example?
What things would you remember while making an interface?
What is data types c++?
How does c++ sort work?