我有一个double值,我需要用整数值除以它。我需要将结果再次作为整数值。然后我需要对double值执行模数除法以获取提醒。我得到了以下代码:
double num = in.nextDouble();
int div = num/20.0;
int modulo = num%20.0;
System.out.println("div= "+div);
System.out.println("modulo= "+modulo);
error: possible loss of precision
int div = num/20.0;
error: possible loss of precision
int modulo = num%20.0;