判断对称数的代码不知道哪里有问题?求解答。

问题遇到的现象和发生背景

这是个判断一个数是否为对称数(例如:121,12321这一类的数)的代码。

用代码块功能插入代码,请勿粘贴截图

#include
int main(){
int x,a,b,c;
b=0;
scanf("%d",&x);
c=x;
while (x>=10)
{
a=x%10;
x=(x-a)/10;
b=b*10+a;
}
if (c==b)
{
printf("yes");
}else
{
printf("no");
}

return 0;

}

运行结果及报错内容

除零外输入什么数都会输出“no”

我的解答思路和尝试过的方法

b的值就是把原来的数反向输出,但是好像没有用。

改动处见注释,供参考:

#include<stdio.h>
int main()
{
    int x,a,b,c;
    b=0;
    scanf("%d",&x);
    c=x;
    while (x > 0)//(x>=10)修改
    {
        a=x%10;
        x=x/10; //x=(x-a)/10;修改
        b=b*10+a;
    }
    if (c==b){
        printf("yes");
    }
    else{
        printf("no");
    }
    return 0;
}

while (x>0)
{
   b= b*10 + x%10;
   x/=10;
}