下面这段代码用来判断一个数的末尾是否为7,例如:7、17、 127……如果是则打印yes,不是则打印no。其中有6个错误,快来改正吧。
修改后:
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a;
scanf("%d", &a);
if (a%10==7)
{
printf("yes");
}
else
{
printf("no");
}
system("pause");
return 0;
}
运行效果: