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
What sorting algorithm does c++ use?
What is the default width for ouputting a long integer using the insertion operator?
Is it possible to provide special behavior for one instance of a template but not for other instances?
What does obj stand for?
Comment on local and global scope of a variable.
How much is c++ certification?
Why do we need c++?
What is the difference between a reference and a pointer?
What character terminates all character array strings a) b) . c) END
Differentiate between a constructor and a method in C++.
What is this pointer in c++?
In which situation the program terminates before reaching the breakpoint set by the user at the beginning of the mainq method?
How can you quickly find the number of elements stored in a static array?
Why is c++ considered difficult?
an integer constant must have atleast one a) character b) digit c) decimal point