write program for palindrome

Answer Posted / gaurav joshi garur (bageshwar)

#include<stdio.h> main()
{
int n, reverse = 0, temp; printf("Enter a number to check if it is a
palindrome or not\n");
scanf("%d",&n); temp = n; while( temp != 0 )
{
reverse = reverse * 10;
reverse = reverse + temp%10;
temp = temp/10;
} if ( n == reverse )
printf("%d is a palindrome number.\n", n);
else
printf("%d is not a palindrome number.\n",
n); 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

What do you understand by zombie objects in c++?

814


Is it possible for a member function to use delete this?

765


How do I run a program in notepad ++?

786


what are the iterator and generic algorithms.

1665


What is the best way to take screenshots of a window with c++ in windows?

776






Explain function overloading

768


What is anonymous object in c++?

817


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

838


Program to check whether a word is a sub-string or not of a string typed

1780


What is the exit function in c++?

717


Define a pdb file.

817


What is meant by forward referencing and when should it be used?

746


What is lazy initialization in c++?

807


Is c++ built on c?

752


What is the full form of dos?

753