Question: C Programming Program on a Perpendicular Bisector -- Areas of concern are highlighted in yellow Problem: can't get my output to mirror the solution for

C Programming

Program on a Perpendicular Bisector -- Areas of concern are highlighted in yellow

Problem: can't get my output to mirror the solution for different inputs.

Picture below shows BOTH my output and required output. Code is below picture.

C Programming Program on a Perpendicular Bisector -- Areas of concern are

#include #include

int main() {

double x1, y1, x2, y2, xmid, ymid, per_bisect, b; double slope;

// First Point

printf("First Point "); printf("Enter x value: "); scanf ("%lf ", &x1); printf ("Enter y value: "); scanf ("%lf", &y1); printf(" "); // Second Point

printf("Second Point "); printf ("Enter x value: "); scanf ("%lf", &x2); printf("Enter y value: "); scanf("%lf", &y2); printf(" ");

printf("The points entered are (%.1lf, %.1lf) and (%.1lf, %.1lf). ", x1,y1,x2,y2);

//slope of line

slope = (y2 - y1)/(x2 - x1);

//mid point calculation

xmid = (x1 + x2)/ 2; ymid = (y1 + y2)/ 2;

//slope of the perpendicular

per_bisect = -1/(slope);

//Yintercept value is b b = ymid - (per_bisect * xmid);

printf("The equation of the perpendicular bisector is y = %.5lfx + %.5lf", per_bisect,b);

return 0; }

Send it to the Server

1: Compare output 0/10 2 Input 7 First Point Enter x value: Enterv value: Second Point Enter x value Enter y value: Your output The points entered are (2.0, -4.0) and (7.0, -2.0). The equation of the perpendicular bisector is y = -2.5 x + 8.2 Your output does not contain .5x+8 Pace 2: Compare output 0 10 Input First Point Enter x value Enter y value: Second Point Enter x value Enter y value: Your output The points entered are (5.0, 1.0) and (4.0, 4.0) The equation of the perpendicular bisector is y = 0.3 x + 1.0 Your output does not contain shows

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!