Example 14: Determine the Collinear Points

Learn how to determine if the given points are collinear or not.

Problem

Given three points, (x1, y1), (x2, y2), and (x3, y3), write a program to check if all three points fall on one straight line.

You need to print the output on the console in the following manner:

  • Collinear
  • Non Collinear

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.