Question: How would I create a C Code using a simple mathematical equation. The code NEEDS TO prompt users to enter variables and calculate based on

How would I create a C Code using a simple mathematical equation. The code NEEDS TO prompt users to enter variables and calculate based on the formula chosen. It also needs to be used in online compilers such as ideone and repl.it

I would like to use the midpoint formula: How would I create a C Code using a simple mathematical equation.

An example of a C Code prompt using a different math equation is as follows:

#include #include

int main() { double a, b, c, discriminant, root1, root2, realPart, imagPart; printf("Enter coefficients a, b and c: "); scanf("%lf %lf %lf", &a, &b, &c);

discriminant = b * b - 4 * a *c;

//condition for real and different roots if (discriminant > 0) { root1 = (-b + sqrt(discriminant)) / (2 * a); root2 = (-b - sqrt(discriminant)) / (2 * a); printf("root1 = %.2lf and root2 = %.2lf", root1, root2); }

//condition for real and equal roots else if (discriminant ==0) { root1 = root2 = -b / (2 * a); printf("root1 = .2%lf and root2 = .2lf;", root1); }

// if roots are not real else { realPart = -b / (2 * a); imagPart = sqrt(-discriminant) / (2 * a); printf("root1 = %.2lf+%.21lfi and root2 = %.2f-%.2fi", realPart, imagPart, realPart, imagPart); } return 0; }

M _21 +22 y1 + y2 = 22

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To create a C program using the midpoint formula which calculates the midpoint M of two points x1 y1 ... View full answer

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!