Home > Back-end >  Multiplication sign and devide the priority is not the same, why BMI calculation without parentheses
Multiplication sign and devide the priority is not the same, why BMI calculation without parentheses

Time:09-16


int x;
Float y;
Double BMI;

BMI=x/y * y;
System. The out. Println (" your BMI value is: "+ BMI);
}

}

CodePudding user response:

Weight is your x, y is the height? If so, the BMI is not equal to x/y) (y *? Don't know your problem, multiplication sign and devide priority is the same, but with the priority of words do not add parentheses when calculated from left to right in turn

CodePudding user response:

reference 1/f, Where - response:
your x is the weight, height is y? If so, the BMI is not equal to x/y) (y *? Don't know your problem, multiplication sign and devide priority is the same, but with priority when words do not add parentheses from left to right in turn calculated

Yes, x is the weight, y is height, x/y float type, isn't it, and then multiplied by the y should not or float type, so should not add do not add parentheses results are the same?

CodePudding user response:

CodePudding user response:

BMI=weight/height * (height)
The brackets and not the same without parentheses, not add parentheses, shouldn't write BMI=weight/height/tall

CodePudding user response:

X and y should type is float

CodePudding user response:

Y and x/x/y * * y (y) are two different formulas,

CodePudding user response:

Mathematics is not pass, will be like this

CodePudding user response:

You might as well try unwrapped formulas, divided into two steps

CodePudding user response:

I'm sorry the math teacher
  • Related