Description
输入一个整型数,判断是否是对称数,如果是,输出yes,否则输出no,不用考虑这个整型数过大,int类型存不下,不用考虑负值;
例如 12321是对称数,输出yes,124421是对称数,输出yes,1231不是对称数,输出no
Input
一个整型数
Output
输出是yes,或者no
Sample Input 1
12321
Sample Output 1
yes
Sample Input 2
1231
Sample Output 2
no
#include<stdio.h>
int main()
{
int a,b,c,tmp;
b=0;
scanf("%d",&a);
c=a;
while(a)
{
tmp=a%10;
b=b*10+tmp;
a=a/10;
}
if(b==c)
{
printf("yes\n");
}
else{
printf("no\n");
}
return 0;
}