how to find slope of a line passing through 2 points code example Example: get slope from two points slope = (y2 - y1) / (x2 - x1)