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
Which line of code in this program is MOST likely to result in an error
rjkz [21]

Answer:

What are the choices?

Explanation:

7 0
3 years ago
Read 2 more answers
Biography of bill gates
Juliette [100K]

Answer:

Bill Gates is a technologist, business pioneer, and altruist. He experienced childhood in Seattle, Washington, with a stunning and steady family who empowered his enthusiasm for PCs at an early age. He dropped out of school to begin Microsoft with his beloved companion Paul Allen. He wedded Melinda French in 1994 and they have three kids. Today, Bill and Melinda Gates co-seat the beneficent establishment bearing their names and are cooperating to give their riches back to society.  

Bill experienced childhood in Seattle with his two sisters. His father, William H. Doors II, is a Seattle lawyer and one of the co-seats of the Bill and Melinda Gates Foundation. His late mother, Mary Gates, was a teacher, University of Washington official, and executive of United Way International.

Explanation:

This is just a short biography and not a full one.

5 0
3 years ago
Read 2 more answers
Henry is studying the effects of deforestation along the slopes of hills and mountains. He wants to take a photo of a mountain s
Annette [7]

Answer:

1) pull out the legs of the tripod to gain the required height and necessary stability

2) adjust each of the legs so that the tripod is level

3) attach the camera to the tripod

5 0
3 years ago
The implementation stage of the SDLC is when the system is moved into operation where it can be used. What stage PRECEDES the im
antiseptic1488 [7]

The stage that precedes the implementation stage of SDLC is <u>testing</u> and it involves checking the functionality of the system.

System design involves the process of determining an overall system architecture, which typically comprises the following:

  • Hardware.
  • End users.
  • Physical processing components.
  • Software.
  • Communication channel.

Generally, there are seven (7) main stages in the systems development life cycle (SDLC) model and these include:

1. Planning.

2. Analysis.

3. Design.

4. Development.

5. Testing.

6. Implementation.

7. Maintenance.

From the above, we can deduce that the stage which precedes the implementation stage of SDLC is testing.

During the testing stage of SDLC, a quality assurance (QA) expert checks the system to determine whether or not it is functioning properly before it is deployed for operation, which is where the system can be used.

Read more: brainly.com/question/20813142

7 0
3 years ago
a client has requested adjustments to the arrangement and placement of elements on an image. what does the client want changed?
qaws [65]

Considering the situation described above, the client wants the <u>image's recipe to be changed.</u>

<h3>What is the Image Recipe?</h3>

Image Recipes are characteristics of an image or picture. It includes features like shape, size, form, pattern, line, shadow, tone, color, contrast, positive space and negative space, etc.

Given that the client needs adjustments to the arrangement and placement of elements on an image, this is a request for a change in the image recipe.

Hence, in this case, it is concluded that the correct answer is "<u>the client wants the recipe of the image changed."</u>

Learn more about the Image Recipe here: brainly.com/question/1605430

6 0
2 years ago
Other questions:
  • If you have machines doing jobs, fewer staff are needed, therefore costs are
    5·2 answers
  • If anybody knows what does this mean I will answer any questions for you and plz answer this right plz what does that envelope w
    5·2 answers
  • A friend is having a problem with keeping a fish tank at the right temperature so the fish stay healthy. Describe how you could
    9·1 answer
  • Which line is not a computer-generated forecast?Which line is not a computer-generated forecast?the black line representing 20th
    12·1 answer
  • How much days are in a year
    9·2 answers
  • Urgent ..algorithm and flowchart to check weather a number is odd or even ???​
    8·2 answers
  • In C++ write a program that prints out PI as a type double and a type float EXACTLY as shown below. Your program should have ONE
    13·1 answer
  • What<br>are<br>the features of secondary storage media​
    13·2 answers
  • Which is the following should be selected in the paragraph dialogue box to prevent page break from occurring within a paragraph
    12·1 answer
  • Add me on Fortnite. Epic is smashman892. *Ik it sux but it's an old account* Comment ur epic
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!