-
XhstormR
public class Test {
public static void main(String[] args) {
int a = 24;
int b = 18;
int c = 36;
int d = 27;
int i = (a + b + c + d) / 4;
System.out.println(i);
}
}代码以上,不懂再问啊,望采纳。
-
qq_慕妹5056700
public class Test { public static void main(String[] args) { int a = 24; int b = 18; int c = 36; int d = 27; Double i = (a + b + c + d) / 4; (最好用double 这样如果不能整除 也会显示出小数点后的数) System.out.println(i); }}
-
suddenly_
double i=(a+b+c+d)/4;不是整除又要保留小数----> double i=(double)(a+b+c+d)/4;