Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save scratchyourbrain/222728cad98472c256a0 to your computer and use it in GitHub Desktop.
Save scratchyourbrain/222728cad98472c256a0 to your computer and use it in GitHub Desktop.
C Program to Check Whether a Number is Palindrome or Not
#include <stdio.h>
int main()
{
int n, reverse=0, rem,temp;
printf("Enter an integer: ");
scanf("%d", &n);
temp=n;
while(temp!=0)
{
rem=temp%10;
reverse=reverse*10+rem;
temp/=10;
}
if(reverse==n)
printf("%d is a palindrome.",n);
else
printf("%d is not a palindrome.",n);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment