weixin_慕妹9028574
2021-08-09 15:27
#include <stdio.h>
int main()
{
int x,y;
x = 10;
y = -3;
printf("x+y=%d\n",x+y);
printf("x-y=%d\n",x-y);
printf("x*y=%d\n",x*y);
printf("x/y=%d\n",x/y);
printf("x%y=%d\n",x%y);
return 0;
}
应该是括号里的%被默认为符号了,再加上一个试试
#include <stdio.h>int main(){ int x,y; x = 10; y = -3; int re1,re2,re3,re4,re5; re1=x+y; re2=x-y; re3=x*y; re4=x/y; re5=x%y; printf("x+y=%d\n",re1); printf("x-y=%d\n",re2); printf("x*y=%d\n",re3); printf("x/y=%d\n",re4); printf("x%%y=%d\n",re5); return 0; }
C语言入门
926028 学习 · 20793 问题
相似问题