Question: Q3. Write a C program to calculate and display the coordinates of midpoint - M of a line segment between two given points - say

Q3. Write a C program to calculate and display the coordinates of midpoint - M of a line segment between two given points - say A and B, the slope of the line s and the distance b/w the points A and B given by d. Your program should prompt the user to enter floating point values for x and y coordinates for the two points - A (x1, y1) and B (x2, y2). Then it calculates the floating point coordinates of the midpoint M (xm, ym) using the formula Xm (x1+x2)2 ym (y1+y2)2 It calculates the slope s (y2-y1)/(x2-x1) It calculates distance using the formula d-sqrt ((x2x1,-+ (y2-y1,-) (Hint-You will need to include math.h, check online on sqrt function usage, it is simple and clear) Then display the values of xm, ym, d and s correct upto two places of decimal Q4a. Write a C program that accepts the value of an angle (xd) in degrees from the user (it should prompt the user to keep 0
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
