Bobby Marvikuan wrote:and OK it could be 0 between 0-699 but why when x=700 it is not 1 still 0?
Well, as per your for loop, x will always be less than width and y will always be less than height
So, if width is 700, maximum value of x would be 699 and 699/700 is 0 in int format
And about decimal points, well, if you are doing operations with double numbers, then yes, rounding off makes sense. But you are already doing operations with int (so, 1/2 would be 0, not 0.5).
I hope this helps.
Regards,
Anayonkar Shivalkar (SCJP, SCWCD, OCMJD, OCEEJBD)