Given the values of m and c for the equation of a line y = (m * x) + c, the task is to find whether the point (x, y) lies on the given line.
Input: m = 3, c = 2, x = 1, y = 5
m * x + c = 3 * 1 + 2 = 3 + 2 = 5 which is equal to y
Hence, the given point satisfies the line’s equation
Input: m = 5, c = 2, x = 2, y = 5
Approach: In order for the given point to lie on the line, it must satisfy the equation of the line. Check whether y = (m * x) + c holds true.
Below is the implementation of the above approach:
GeeksforGeeks has prepared a complete interview preparation course with premium videos, theory, practice problems, TA support and many more features. Please refer Placement 100 for details
- Check whether a point lies inside a sphere or not
- How to check if a given point lies inside or outside a polygon?
- Check if a point lies on or inside a rectangle | Set-2
- Check whether a given point lies on or inside the rectangle | Set 3
- Check whether a given point lies inside a rectangle or not
- Check whether a given point lies inside a triangle or not
- Equation of straight line passing through a given point which bisects it into two equal line segments
- Find a point that lies inside exactly K given squares
- Find if a point lies inside a Circle
- Find if a point lies inside, outside or on the circumcircle of three points A, B, C
- Reflection of a point about a line in C++
- Find the other end point of a line with given one end and mid
- Choose points from two ranges such that no point lies in both the ranges
- Program to find the mid-point of a line
- Direction of a Point from a Line Segment
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.