Created
December 21, 2014 14:26
-
-
Save scratchyourbrain/222728cad98472c256a0 to your computer and use it in GitHub Desktop.
C Program to Check Whether a Number is Palindrome or Not
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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