新手求指教
#include <stdio.h>#include <string.h>
void main()
{
float x=2.5,y=4,s;
int a=7;
s=x+a%3*(int)(x*y)%2/4;
printf("%f",s);
}
运算下来是2.5但是我自己笔算下来是10.5求大佬帮我梳理一下逻辑 a%3*(int)(x*y)%2/4
a%3=1
(int)(x*y)%2=10%2=0
s=x+a%3*(int)(x*y)%2/4=2.5+0=2.5 s=x+a%3*(int)(x*y)%2/4;
s = 2.5 + 7 % 3 * (2.5 * 4) % 2 / 4
= 2.5 + 1 * (10) % 2 / 4
= 2.5 + 0 / 4
= 2.5
页:
[1]