1 # include
2
3 int main(void)
4 {
5 int m,val;
6 int sum = 0;
7
8 printf(请输入您需要判断的数字: );
9 scanf("%d", &val);
10
11 m = val;
12 while (m)
13 {
14 sum = sum * 10 + m%10;
15 m /= 10;
16 /*
17 试数:
18 1> m=1234成立
19 sum=0*10+1234%10=4
20 m=m/10=123;
21 2> m=123成立
22 sum=4*10+123%10=43
23 m=123/10=12
24 3> m=12成立
25 sum=43*10+12%10=432
26 m=12/10=1
27 4> m=1成立
28 sum=432*10+1%10=4321
29 m=1/10=0
30 5> m=0不成立退出循环
31 */
32 }
33 if (sum == val)
34 printf("Yes\n");
35 else
36 printf("No\n");
37
38 return 0;
39 }