Could some please offer any insight into why this code is outputting 40? I tried using doubles instead of integers and using the Math.round method to make sure it wasn't a precision issue.
{
int x,y ;
x = ((( 80 + 80 + 80 + 80 + 80) / 500) * 100);
y = ((x / 2) + (80 / 4) + (80 / 4));
System.out.println(y);
}
I've evaluated the same expression using a calculator and just my own head and on all accounts it should be 80! If I'm making a really dumb mistake I'd like to know but otherwise I'm just curious as to why this is and how to get around it, thanks in advance!