given two points which may or may not be collinear, how to calculate the total number of integer point which lies on the line b/w these two points…

@anup1pma : Please correct your question before I answer that because two points are always collinear .

1 Like

May be he mean to say that the line formed by those 2 points may or may not be parallel to coordinate axes.

1 Like

Actually my question was to find out total no. of lattice points b/w two lattice points… ya two points are always collinear sorry…

I found the ans…it is gcd of (|x2-x1|,|y2-y1|)+1…

where two points are (x1,y1),(x2,y2)…

thank u