in Others edited by
691 views
0 votes
0 votes

Consider the line $y=\frac{n}{m}x$, where $n$ and $m$ are positive integers.

  1. If mq - np < 0, then is the point (p,q) above the line, below the line, or on the line?
  2. Complete the following function, that returns true if the line segment with endpoints (p,q) and (r,s) intersects the line $y=\frac{n}{m}x$, by writing the line number and the content of each box in your answer book.
  1: function clash (m, n, p, q, r, s: integer): Boolean;
  2: begin
  3: clash = false;
  4: if(m*q - n*p)⊏⊐ 0 then clash:= true;
  5: if(m*s - n*r)⊏⊐ 0 then clash:= true;
  6: if(m*q - n*p)⊏⊐ 0 and (m*s - n*r)⊏⊐ 0 then clash:= true;
  7: if(m*q - n*p)⊏⊐ 0 and (m*s - n*r)⊏⊐ 0 then clash:= true;
  8: end;
in Others edited by
691 views

1 comment

@ sir Can someone provide solution for this? Thanks

0
0

Please log in or register to answer this question.

Related questions