public class HelloWorld { public static void main(String[] args) { int m = 5; int n = 7; int x=(m*8/(n+2))%m; System.out.println("m:" + m); System.out.println("n:" + n); System.out.println("x:" + x); }}
4是这样来的:4%5 =4 (求余数,商是0,余数4)
n + 2 = 9
m * 8 = 40
40 / 9 = 4(结果为整型,小数点后舍去)
4 % 5 = 5(4模5等于4)
4 / 5?兄弟,你是不是把%看成除号了 = =