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 different in C++, compare with unix?
What is expression parser in c++
What do you mean by enumerated data type?
What is the purpose of ios::basefield in the following statement?
Is overriding possible in c++?
What do you mean by translation unit in c++?
What is the advantage of c++ over c?
What is the benefit of c++?
Which operator cannot overload?
To which numbering system can the binary number 1101100100111100 be easily converted to?
What is cin clear () in c++?
How can you say that a template is better than a base class?
What are pointer-to-members in C++? Give their syntax.
How many different levels of pointers are there?
Is c++ faster than c?