Im currently starting from scratch to refresh some java having been away for a while. i was reading over HWS javanotes and came across this blurb, maybe someing can clear it up for me.
If N is an integer variable, then N/100 is an integer, and 1/N is equal to zero for any N greater than one! This fact is a common source of programming errors. You can force the computer to compute a real number as the answer by making one of the operands real: For example, when the computer evaluates 1.0/N, it first converts N to a real number in order to match the type of 1.0, so you get a real number as the answer.
why is 1/N equal to 0 if N > 1? ;where N is an int?
The simple Logic behind it is that whenever you perform any operation like X/Y where X and Y both are integers, and if the answer is not a perfect interger then simple the digits after the decimal point . are removed.
so if answer of 5/2 is 2.50 then .50 is removed and 2 is given as a answer in interger format.
In case 1/N if N>1 then the real answer will always be 0.#### In this case all ####s are removed and 0 as a simple interger is returned as answer.