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
Need help asap please​
Fofino [41]
Because you can make it to where they cannot find or see or look or talk or anything on your profile it can cut off Comunication from the person. It can also protect your safety!
6 0
2 years ago
Carl is beginning a digital forensic investigation. he has been sent into the field to collect a machine. when he arrives, he se
postnew [5]

Answer:

Volatile memory analysis

Explanation:

volatile data analysis in a computer's memory dump memory forensics is used by information security specialists to examine and identify assaults or harmful actions that leave no clearly identifiable trails on hard disk data which os what Carl decides to preserve as much data as possible by capturing data in memory

6 0
2 years ago
Besides technical skill, what is the most important factor for staying employed and being offered promotions?
Natali [406]

Obtaining a college degree= while this is nice, you can get a lot of placed with just a GED or Highschool Degree

pursuing self-directed learning=this will help you

showing professional behavior= yes this helps a lot

setting long-term goals= this could help you in the end game

Overall, i think it would be between B and C, though C sounds correct over B because even if you pursue self directed learning, you could still get fired or quit or not get a promotion.

3 0
2 years ago
Read 2 more answers
List any four e-commerce website​
Ipatiy [6.2K]

Answer:

Amazon. Founded in the US in 1994, Amazon started as an online bookstore that later diversified to products including media, electronics, apparel, furniture, food, toys, and jewelry.

eBay. ...

Walmart. ...

Etsy. ...

Home Depot. ...

Target. ...

Best Buy. ...

Wayfair.

5 0
2 years ago
Read 2 more answers
(15) What is the best definition of a contextual tab?
katen-ka-za [31]

  1. What is the best definition of a contextual tab-<u>(c) A tab that appears in context with what you are working on</u>
  2. A theme can be applied to-<u>(d) All of the answers are correct</u>

Explanation:

  1. What is the best definition of a contextual tab-<u>(c) A tab that appears in context with what you are working on</u>
  2. A theme can be applied to-<u>(d) All of the answers are correct</u>
  3. What is the difference between Reading view and Slide Show view-<u>(c) Slide Show view contains annotation tools while Reading view does not</u>
  4. Which of the following is not a view available from the Presentation Views section of the View tab-<u>(a) Slide Show</u>
  5. Where can you find the command to access slide, note, or handout masters-<u>(d) View tab</u>
  6. To rotate a text box, which handle would you use-<u>(d) You must use the commands on the Home tab</u>
  7. To change a black and white, boring presentation into something a bit more pleasing to the eye, what option would be best-<u>(b) Templates</u>
  8. The area on the top of your PowerPoint screen, as seen in the image, is commonly referred to as the what-<u>(a) Menu Options</u>
  9. What does it mean when a command button is grayed out-<u>(c) The command is disabled and requires an action first.</u>
  10. The area on a slide that holds text that will appear in the presentation outline is a-<u>(a) text box</u>
  11. To easily find a presentation that you were working on earlier today, you could-(<u>c) all of the above</u>

6 0
3 years ago
Other questions:
  • Write a program that uses the function isPalindrome given in Example 6-6 (Palindrome). Test your program on the following string
    9·1 answer
  • To become a news anchor, you should get a Bachelor's degree in:
    11·2 answers
  • What is zenmap typically used for? how is it related to nmap? describe a scenario in which you would use this type of applicatio
    14·1 answer
  • What’s some WiFi passwords for some big brands that I can connect to while traveling?
    7·1 answer
  • PLZ HELP ME! What is a false statement about online time?
    9·1 answer
  • The partners of a small architectural firm are constantly busy with evolving client requirements. To meet the needs of their cli
    11·1 answer
  • Question 2 of 5
    8·1 answer
  • Create a class named Invoicing that includes three overloaded computeInvoice() methods for a book store: see pages 196 for examp
    7·1 answer
  • If you were any type of fnaf charater who would you be and why?
    10·2 answers
  • Write down the stages in the information prcessing cycle in correct order​
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!