图中的做法会出现忽略scanf返回值的警告
改成这样就没问题了↓
(修改方法参考https://zhidao.baidu.com/question/1759730286377914268.html的回答)
#include
int main(void)
{
unsigned int A,B;//要求是正整数所以要用unsigned int
if(scanf("%d%d",&A,&B)==2){;
printf("%d + %d = %d\n",A,B,A+B);
printf("%d - %d = %d\n",A,B,A-B);
printf("%d * %d = %d\n",A,B,A*B);
printf("%d / %d = %d\n",A,B,A/B);
}
return 0;
}
亲测正确的请采纳哦😃
#include
int main()
{
scanf("%d%d",&a,&b);
printf("%d + %d = %d\n",a+b);
printf("%d - %d = %d\n",a-b);
printf("%d * %d = %d\n",a*b);
printf("%d / %d = %d\n",a/b);
return 0;
}
对不对啊!!!对的话采纳下呗,我想看直播去了……