the reason it equals 4.0 is because the variable u r dividing by 10 is of type int... i dont think you know about typecasting yet but if u change 10 to 10.0 it should give u the answer you're looking...