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: 
The code I have so far can't calculate the midpoint with the formula I input, I need help finishing it. The code I have so far looks like:
#include
#include
int main()
{
int midpoint2;
float midpoint1, p1x, p1y, p2x, p2y;
float temp1, temp2;
/* User input coordinate 1 */
printf(" Enter the the first coordinate x1, y1: ");
scanf("%f,%f", &p1x, &p1y);
/* User input coordinate 2 */
printf(" Enter the second coordinate x2, y2: ");
scanf("%f,%f", &p2x, &p2y);
/* Calculate the midpoint between both points */
/* Equation for midpoint=((x1+x2)/2,(y1+y2)/2) */
temp1 = p1x + p1y;
temp2 = p2x + p2y;
printf("The midpoint between coordinates 1 and 2 are:%f");
}
M = (x1+x2 yi+y2 2
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
