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. My
C Programming
Program on a Perpendicular Bisector -- Areas of concern are highlighted in yellow
Problem: can't get my output to mirror the solution.
My output is in the form of y = -2.50x-8.25 , and should show y = -2.5x + 8.25......
this should be changed to + 8.25
Program is to output the following:
my output shows:
my code:
#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 (%lf, %lf) and (%lf, %lf). ", 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 = %2.2fx-%2.2f", per_bisect,b); return 0; }
Your program interface should be as follows: First Point Enter x value: 2.0 Enter y value: -4.0 second Point Enter x value: 7.0 Enter y value: -2.0 The points entered are (2.0, 4.0) and (7.0, -2.0 The equation of the perpendicular bisector is y --2.5x +8.25Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started