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
Write a SELECT statement that joins the Categories table to the Products table and returns these columns: category_name, product
Sphinxa [80]

Answer & Explanation:

1) Query:

SELECT Product_Name, Category_Name, List_Price

FROM Products AS P JOIN Categories AS C

ON C.Category_ID = P.Category_ID

ORDER BY Category_Name, Product_Name ASC;

2) Query:

SELECT C.Last_Name, C.First_Name, Order_Date, P.Product_Name, Item_Price, Discount_Amount, Quantity

FROM Customers AS C JOIN Orders AS O

ON C.Customer_ID = O.Customer_ID

JOIN Order_Items AS OI

ON O.Order_ID = OI.Order_ID

JOIN Products AS P

ON OI.Product_ID = P.Product_ID

ORDER BY Last_Name, Order_Date, Product_Name;

3) Query:

SELECT Category_Name, Product_ID

FROM Categories LEFT JOIN Products

ON Categories.Category_ID = Products.Category_ID

WHERE Product_ID IS NULL;

4) Query:

SELECT 'SHIPPED' AS Ship_Status, Order_Id, Order_Date

FROM Orders

WHERE Ship_Date IS NOT NULL

UNION

SELECT 'NOT SHIPPED' AS Ship_Status, Order_ID, Order_Date

FROM Orders

WHERE Ship_Date IS NULL

ORDER BY Order_Date;

3 0
3 years ago
. Which of the following is NOT a
joja [24]

Answer:

solution

Explanation:

The correct option is - solution

Reason -

To solve a problem,

Firstly we give input , then system will process that input which then gives output.

Solution is not a part of the process.

So, Solution is not a significant part of a simple problem.

7 0
2 years ago
How does a cloud-first strategy differ from other approaches to cloud?
Irina18 [472]

Cloud-first strategy differ from other approaches as It keeps all the services performed by legacy systems while moving to the Cloud in a staggered approach.

<h3>What is a cloud first strategy?</h3>

The change of cloud computing has brought about  “cloud-first” strategy.

This  is known to be a way to computing that tells that a firm should look first to cloud solutions when creating new processes or taking in old processes before taking in non-cloud-based solutions.

Note that Cloud-first strategy differ from other approaches as It keeps all the services performed by legacy systems while moving to the Cloud in a staggered approach.

See options below

it enables an organization to completely move to the cloud without infrastructure or support requirement

it keeps all the services performed by legacy systems while moving to the cloud in a staggered approach.

it partners technology with multiple other disciplines for comprehensive business transformation.

it uses artificial intelligence to automate all business processes and completely eliminate human error.

Learn more about cloud from

brainly.com/question/19057393

#SPJ1

6 0
2 years ago
A use case description is the best place to start for the design of the forms for a user interface.​ True False
Veronika [31]

Answer:

false

Explanation:

6 0
3 years ago
Place the optical discs in the increasing order of storage capacity.<br><br> UDO<br> CD<br> DVD
romanna [79]
<h2>Hello!</h2>

The answer is:

  1. CD
  2. DVD
  3. UDO
<h2>Why?</h2>

Optical disks are circular disks used as storage for binary data usually made of polycarbonate. The data is stored in the disc using a laser machine and accessed using a laser diode illuminating the data path in an optical disc drive.

CD: Compact Discs are the most basic optical disk used today, with only a capacity that goes from 0.7 GB (700 MB) to 0.84 GB (840 MB).

DVD: Digital Versatile Discs increase the storage up to 6 times compared with a CD, the capacity of DVDs optical disks goes from 4.7 GB (4700 MB) to about 17 GB(17000 MB).

UDO: Ultra Density Optical have high capacity storage that goes from 30 GB (30000 MB) to about 60 GB (6000 MB).

Have a nice day!

4 0
3 years ago
Other questions:
  • In your presentation you added a text box to?
    5·1 answer
  • Java languageThe cost to ship a package is a flat fee of 75 cents plus 25 cents per pound.1. Declare a constant named CENTS_PER_
    5·2 answers
  • A company decides to reduce its IT labor force by hiring an external company to manage various aspects of IT administration, suc
    6·1 answer
  • A one-to-many binary relationship allows an occurrence of the entity type on the "one side" of the relationship to be associated
    5·1 answer
  • Fax machines, voice mail, electronic mail, and electronic conferencing are all examples of _________.
    15·2 answers
  • Rint "Censored" if userInput contains the word "darn", else print userInput. End with newline.
    11·1 answer
  • Which two technologies support the building of single-page applications? and are two technologies helpful in building single pag
    12·1 answer
  • Why might a variable used for output have to be of a different type then a variable used for input? ​
    12·1 answer
  • DES: Group of answer choices A) is a commonly used symmetric encryption B) algorithm that was developed in the mid-C) 1970s was
    6·1 answer
  • In paragraph form, explain and describe at least three common situations in which you would yield the right-of-way.
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!