#include <stdio.h> #include <stdlib.h> int main() { float slope, M; int point1,p
ID: 3781755 • Letter: #
Question
#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 ?
Explanation / Answer
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.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.