Posts Tagged ‘Palindrome’

Palindrome or Not

Posted: February 12, 2010 in Basic Programming
Tags:

/* Program to check whether a given number is palindrome or not */

#include<stdio.h>

main()
{
int num,rem,temp,reverse=0;
printf(“\nEnter the number: “);
scanf(“%d”,&num);
temp=num;
while(temp>0)
{
rem=temp%10;
reverse=reverse*10+rem;
temp/=10;
}
if(reverse==num)
printf(“\nThe given number is palindrome!\n\n”);
else
printf(“\nThe given number is not palindrome!\n\n”);
}

Advertisements