include include int main float slope M int point1point2 b Y

#include <stdio.h>
#include <stdlib.h>

int main()

{

float slope, M;
int point1,point2, b, Y;

printf(\"=============================Equation Computation===============================\");
printf(\"\ Enter The Slope Of A Line: \");
scanf(\"%f\", &slope);

printf(\"\ Enter A Point On The Line: \");
scanf(\"%d,%d\", &point1,&point2);

b = point2 - slope*point1;
M = slope;
Y = Mx + b;
printf(\"\ The Equation Of The Line Is: \", Y);

return(0);


}

I just want the equation of the line to be displayed, What needs to be fixed here. I assume its something with the Y ?

Solution

In place of Y, you should put Mx+b i.e., printf statement would be something like this:

printf(\"The equation of line is: Y = %fx + %d\",M,b);

I hope it helps.

#include <stdio.h> #include <stdlib.h> int main() { float slope, M; int point1,point2, b, Y; printf(\

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site