weixin_慕虎6457657
2021-12-30 15:33
#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;
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;
}
printf("x%%y=%d\n",x%y );
在输出时,%%默认输出为%就比如下面这段代码
#include <stdio.h>
int main()
{int x;
x = 10;
printf("x=%%d\n",x);
return 0;
}
输出结果为x=%d
C语言入门
926207 学习 · 20797 问题
相似问题