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
What are the implicit member functions of class?
What programming language should I learn first?
Give an example of run-time polymorphism/virtual functions.
Can a class be static in c++?
What is a terminating character in c++?
How can you quickly find the number of elements stored in a static array?
Can turbo c++ run c program?
What do nonglobal variables default to a) auto b) register c) static
What you know about structures in C++?
Out of fgets() and gets() which function is safe to use?
What is encapsulation in C++? Give an example.
explain the reference variable in c++?
What are the advantages of using pointers in a program?
What is the difference between map and hashmap in c++?
Explain one method to process an entire string as one unit?