[求助]TC.(%d+%d)%7=%d\n得答案为什么是%d!
我输入程序如下.两次!main()
{
int monday,day,week;
monday=1;
day='n';
week=(monday+day)/7;
printf("(%d+%d)/7=%d\n",monday,day,week);
}
得到答案15这是商..显然不对.于是我想到用余数试试
main()
{
int monday,day,week;
monday=1;
day='n';
week=(monday+day)%7;
printf("(%d+%d)%7=%d\n",monday,day,week);
}
得到答案是%d..这个更错..
我又想如果main()
{
int monday,day,week1,week;
monday=1;
day='n';
week1=(monday+day)/7;
printf("(%d+%d)/7=%d\n",monday,day,week1);
week=(monday+day)-week1*7;
printf("(%d+%d)-%d*7=%d\n",monday,day,week1,week);
}
虽然这次答案出来了..
但是我想问问.为什么(%d+%d)%7=%d\n,monday,day,week);
答案会是%d..如果是按照符号意思.应该是很括号的和除7的余数就是星期几的答案啊