int m = 1; int n = 2; double y = 2.0; System.out.println(m + n); //3 System.out.println(m - n); //-1int m = 1;int n = 2;double y = 2.0;System.out.println(m + n); //3System.out.println(m - n); //-1System.out.println(m * n); //2System.out.println(m / n

来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/23 07:07:13
intm=1;intn=2;doubley=2.0;System.out.println(m+n);//3System.out.println(m-n);//-1intm=1;intn=2;doubl

int m = 1; int n = 2; double y = 2.0; System.out.println(m + n); //3 System.out.println(m - n); //-1int m = 1;int n = 2;double y = 2.0;System.out.println(m + n); //3System.out.println(m - n); //-1System.out.println(m * n); //2System.out.println(m / n
int m = 1; int n = 2; double y = 2.0; System.out.println(m + n); //3 System.out.println(m - n); //-1
int m = 1;
int n = 2;
double y = 2.0;
System.out.println(m + n); //3
System.out.println(m - n); //-1
System.out.println(m * n); //2
System.out.println(m / n); //0
System.out.println(m / y); //0.5
System.out.println(m / 2.0); //0.5
System.out.println(m % n); //1
我就想问,除里面除法,跟求佘怎么算,可以通俗的讲下吗

int m = 1; int n = 2; double y = 2.0; System.out.println(m + n); //3 System.out.println(m - n); //-1int m = 1;int n = 2;double y = 2.0;System.out.println(m + n); //3System.out.println(m - n); //-1System.out.println(m * n); //2System.out.println(m / n
除法和求余就是数学里的那种啊,除法得到的是商,求余得到的是余数.
这里有类型转换的问题.两个int相除,就是整数除整数,得到的结果没有小数位
int和double相除,会转换会精度高的double,所以相当于1.0/2.0,而且结果也是double