Description:
Check if an integer is a palindrome.
Check if an integer is a palindrome.
C Code
#include <stdio.h>
int main() {
int x = 121, rev = 0, orig = 121;
while (x > 0) {
rev = rev * 10 + x % 10;
x /= 10;
}
printf("%s\n", (rev == orig) ? "Palindrome" : "Not Palindrome");
return 0;
}
Expected Output
Palindrome