
- Forum
- Programming Talk
- C and C++
- palindrome
palindrome
This is a discussion on palindrome within the C and C++ forums, part of the Programming Talk category; how to check if any given number is a palindrome or not... the number is entered from the user...
-
02-28-2008, 05:44 AM #1
- Join Date
- Feb 2008
- Answers
- 5
palindrome
how to check if any given number is a palindrome or not...
the number is entered from the user
-
02-28-2008, 11:07 AM #2
- Join Date
- Mar 2007
- Location
- coimbatore, india
- Answers
- 21
palindrome
a = xxxxxxxxx;
b = a;
c = 0;
while(b > 0)
{
c *= 10;
c += b%10;
b = b/10;
}
if(a == c)
{
'palindrome';
}
else
{
'not palindrome';
}
-
03-19-2008, 10:36 AM #3
- Join Date
- Mar 2008
- Answers
- 1
palindrome
void main()
{
int n,d,sum=0,ori;
printf("\nEnter any No. :");
scanf("%d",&n);
ori=n;
while(n>=1)
{
d=n%10;
n=n/10;
sum=sum*10+d;
}
if(sum==ori)
printf("\n given number is a palindrome.");
else
printf("\ngiven number is a not palindrome.");
getch();
}
-
Sponsored Ads

Reply With Quote






