I've been reviewing my Java for a class I've taken for the whole year and haven't been doing well on. They have a separate review book called "Be Prepared." I want to see if I get the math behind this line.
result = (1 / 2) * n * (n + 1); // result is 0.0
The thing is, this is basic basic basic. I need to know if I'm actually getting this. It looks like my like (1/2) is 0.5. That cast to an int is 0. That's why the whole thing is 0.0.
Am I right?
This book is how you get ready for the AP test. Anyone done eimacs who can help?