check number is palindrome or not in c

/* run this program using the console pauser or add your own getch, system(“pause”) or input loop */

#include
int main()
{
int n, nInteger = 0, remainder, oInteger;

printf(“Enter an integer: “);
scanf(“%d”, &n);

for(oInteger = n; n!=0; n/=10 )
{
remainder = n%10;
nInteger = nInteger*10 + remainder;

}

if (oInteger == nInteger)
printf(“%d is a palindrome.”, oInteger);
else
printf(“%d is not a palindrome.”, oInteger);

return 0;
}

Leave a Reply

Your email address will not be published. Required fields are marked *