向上取整用Math.ceil(double a)
向下取整用Math.floor(double a)
举例:
double a=35;
double b=20;
double c = a/b;System.out.println(c); //1.75
System.out.println(Math.ceil(c)); //2.0
System.out.println(Math.floor(c)); //1.0
mb6304a73bed12a 博主文章分类:基础知识
向上取整用Math.ceil(double a)
向下取整用Math.floor(double a)
举例:
double a=35;
double b=20;
double c = a/b;System.out.println(c); //1.75
System.out.println(Math.ceil(c)); //2.0
System.out.println(Math.floor(c)); //1.0
JAVA 对50取余数
举报文章
请选择举报类型
补充说明
0/200
上传截图
格式支持JPEG/PNG/JPG,图片不超过1.9M