数学趣题——判断回文数字

   1: #include <string.h>
   2: #include <stdio.h>
   3:  
   4: int IsCircle(int n);
   5: int Reverse(int i);
   6:  
   7: int main()
   8: {
   9:     int n;
  10:     printf("input a number\n");
  11:     scanf("%d", &n);
  12:  
  13:     if (IsCircle(n))
  14:         printf("%d is Circle\n", n);
  15:     else
  16:         printf("%d is not Circle\n", n);
  17:     return 0;
  18: }
  19:  
  20: int IsCircle(int n)
  21: {
  22:     int m;
  23:     m = Reverse(n);
  24:     if (m == n)
  25:         return 1;
  26:     else
  27:         return 0;
  28: }
  29:  
  30: int Reverse(int i)
  31: {
  32:     int m, j=0;
  33:     m = i;
  34:     while (m)
  35:     {
  36:         j = j*10 + m%10;
  37:         m = m/10;
  38:     }
  39:  
  40:     return j;
  41: }

你可能感兴趣的:(数字)