当我运行此代码时,这些是我得到的答案:2678.9854&2677.311
这是一个四舍五入的问题,还是这两个单独的问题?
private float x = 2745.96f;
private float percent = 0.025f;
public String calculate()
{
float divide = x / (1 + percent);
float subtract = x - (x * percent);
return String.valueOf(divide) + " " + String.valueOf(subtract);
}