请问一下,这哪里有问题,也可能全错了,新生看不出来

img

img

e应该是 e= (a/10)%10
if中应该是if(b == c && d==e)

让你输入一个5位数,你a是这个5位数本身,不是万位啊,你拿a去跟c比,什么时候也不会相等
把a==c改成b==c

if 的判断条件错了,你细看这条件不可能成立,应该是

if(b==c&&d==e)

img

根据你代码改的:


#include <stdio.h>
int main()
{
    int a,b,c,d,e;
    scanf("%d",&a);  // a = 12521
    b = a/10000;     //b =1   
    c = a % 10;      // c =1
    d = (a/1000)%10;    // d =2
    e = (a%100)/10;    // e = 2
    if(b==c && d==e)
        printf("yes");
    else
        printf("no");
    return 0;
}