P043.c (462B)
1 /* Write a program to check palindrome number. */ 2 3 #include <stdio.h> 4 int main() 5 { 6 int num, temp, rev; 7 printf("Enter the number : "); 8 scanf("%d", &num); 9 temp = num; 10 rev = 0; 11 while (temp > 0) 12 { 13 rev = (rev * 10) + (temp % 10); 14 temp /= 10; 15 } 16 if (num == rev) 17 { 18 printf("%d is a palindrome number.", num); 19 } 20 else 21 { 22 printf("%d is not a palindrome number.", num); 23 } 24 return 0; 25 }