#include int main () { float p1_x = 0,p2_x = 0, p1_y =0, p2_y = 0; printf("Enter the x-coordinate of point 1: "); scanf("%f",&p1_x); printf("Enter the y-coordinate of point 1: "); scanf("%f",&p1_y); printf("Enter the x-coordinate of point 2: "); scanf("%f",&p2_x); printf("Enter the y-coordinate of point 2: "); scanf("%f",&p2_y); float slope = (p2_y - p1_y) / (p2_x - p1_x); // No need to check for divide by zero case here- as it displays "inf" in case of infinity. // But, It is a good practice to check as the value might be used in later computations . printf(" The slope is : %f\n",slope); }