随机输入一个整数,若整数中含数字5则输出yes!,否则输出no!。

为什么含5不等于5
int n;
printf("请输入整数n");
scanf("%d",&n);
while (n!=0&&n%10!=5)
{
n=n/10;
}
if (n==0)
{
printf("no");
}
else
{
printf("yes");
}
return 0;
}

验了下代码,没什么问题呀,建议详细讲下你的问题所在。

#include <stdio.h>
int main()
{
    int n;
    printf("请输入整数n");
    scanf("%d",&n);
    while (n!=0&&n%10!=5)
    {
        n=n/10;
    }
    printf("n:%d\n",n);
    if (n==0)
    {
        printf("no");
    }
    else
    {
        printf("yes");
    }
    return 0;
}