1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
zubka84 [21]
3 years ago
7

Write a C program to calculate and display the coordinates of midpoint - M of a linesegment between two given points - say A and

B, the slope of the line - s and the distance b/wthe points A and B given by d. Your program should prompt the user to enter floating pointvalues for x and y coordinates for the two points - A (x1, y1) and B (x2, y2). Then it calculatesthe floating point coordinates of the midpoint - M (xm, ym) using the formula -Xm
Computers and Technology
1 answer:
pychu [463]3 years ago
6 0

Answer:

//Program in C.

// header file

#include <stdio.h>

#include <math.h>

// main function

int main(void) {

   // variables

float x1,y1,x2,y2;

float s,xm,ym,d;

// ask to enter x coordinate of A

printf("Enter coordinate (x) of point A:");

// read x1

scanf("%f",&x1);

// ask to enter y coordinate of A

printf("Enter coordinate (y)  of point A:");

// read y1

scanf("%f",&y1);

// ask to enter x coordinate of B

printf("Enter coordinate (x) of point B:");

//read x2

scanf("%f",&x2);

// ask to enter y coordinate of B

printf("Enter coordinate (y) of point B:");

// read y2

scanf("%f",&y2);

// calculate Midpoint of A and B

xm=(x1+x2)/2;

ym=(y1+y2)/2;

// calculate slope of the line

s=(y2-y1)/(x2-x1);

// calculate Distance between two points

d=sqrt(((x2-x1)*(x2-x1))+((y2-y1)*(y2-y1)));

// print result

printf("Midpoint of both the point is: %f %f",xm,ym);

printf("\nSlope of both the line is: %f",s);

printf("\nDistance between both the point is: %f",d);

return 0;

}

Explanation:

Read the x & y coordinates of both the points.Then calculate the Midpoint of both the and assign it to variables "xm"&"ym".Then calculate the slope of the line and assign it to variable "s".Then find the distance between the two points and assign it to variable "d".Print all these results.

Output:

Enter coordinate (x) of point A:2

Enter coordinate (y) of point A:3

Enter coordinate (x) of point B:9

Enter coordinate (y) of point B:8

Midpoint of both the point is: 5.500000 5.500000

Slope of both the line is: 0.714286

Distance between both the point is: 8.602325

You might be interested in
what is the name of the program that enables the device and operating system to communicate with each other?
Fittoniya [83]

Answer:

Explain Operating System working: OS works as an intermediate between the user and computer. It helps the user to communicate with the computer without knowing how to speak the computer's language. The kernel is the central component of a computer operating systems.

Explanation:

3 0
2 years ago
What are the pieces of information that describe the appearance of a cells content
Allushta [10]

Answer:

Information about the parts of a cell, its location and role will help describe the appearance of a cell's content.

Organelles are cell structures that include the nucleus, cytoplasm, cell membrane among others. One can view these using a light microscope.

1. Cell Membrane is a fluid mosaic. It is the outer boundary of the cell.

2.Cytoplasm is the fluid inside the cell. It is located between the nucleus and the cell membrane.

3.Nucleus is the control center of the cell and is located at the center.

4 0
2 years ago
What does limited access to a document mean?
Vlad [161]

Answer:

D. It does not reflect any changes made in the document

Explanation:

A limited access is usually done by middle level and top level managers in an organisation to prevent other staff member to edit or make changes to confidential documents when they are out of the office, though the staff can read it, they can not make changes to it.

6 0
3 years ago
Read 2 more answers
Using emails for time-sensitive messages is an example of:
blagie [28]

Answer:time-sensitive email

5 0
3 years ago
In windows vista, which process allows you to display two documents side by side?
Semmy [17]
By dragging one tab the the top right corner and holding for a few seconds it will automatically take up a certain proportion of the screen. By doing the same to the left side, the documents will be side by side and ready to multi-task with ease. This process is called "splitting screens".
7 0
2 years ago
Read 2 more answers
Other questions:
  • What is the software called that allows the user to create, access, and manage a database? question 8 options:
    10·1 answer
  • What makes Group Policy such a powerful tool is its ability to enable security administrators to:_________.
    8·1 answer
  • How should you decide what to wear to an interview? What kind of things should be considered?
    12·1 answer
  • Complete the following table.
    6·1 answer
  • 100 POINTS + BRAINLYEST TO FIRST PERSON THAT IS CORRECT!!! Which items can be found in the Properties section of the Backstage V
    15·2 answers
  • A(n) ____ local area network is a network in which devices use high-frequency radio waves to communicate with a base station, wh
    11·1 answer
  • Public class Bird
    6·1 answer
  • What aspect should you consider before adding pictures to a document?
    6·1 answer
  • X = 10<br> y = 20<br> x &gt; y<br> print("if statement")<br> print("else statement")
    6·1 answer
  • Calculate the time complexity for the following function in terms of Big O notation. Explain your answer.
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!