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
m_a_m_a [10]
3 years ago
13

3. Write a program that asks the user to type the coordinate

Computers and Technology
1 answer:
Serhud [2]3 years ago
4 0

<u>Answer: </u>

<em>#include <stdio.h> </em>

<em>#include <math.h> </em>

<em>int main() </em>

<em>{ </em>

<em>float x1, y1, x2, y2, gdistance; </em>

<em>printf("Input x1: "); </em>

<em>scanf("%f", &x1); </em>

<em>printf("Input y1: "); </em>

<em>scanf("%f", &y1); </em>

<em>printf("Input x2: "); </em>

<em>scanf("%f", &x2); </em>

<em>printf("Input y2: "); </em>

<em>scanf("%f", &y2); </em>

<em>gdistance = ((x2-x1)*(x2-x1))+((y2-y1)*(y2-y1)); </em>

<em>printf("Distance between the said points: %.4f", sqrt(gdistance)); </em>

<em>printf("\n"); </em>

<em>return 0; </em>

<em>} </em>

<em>Here we need two coordinates so we need 4 variables namely x1, y1, x2, y2</em> to obtain the input from the user and to calculate distance we need another variable. <em>So finally the result should be printed.</em>

You might be interested in
Assume you have the following array: int[] values = new int[15]; What will happen if the following code is executed? int[15] = 2
andrey2020 [161]

Answer:

You are creating an array "values" which stores 15 integers. And if we will write int[15]=20, we are not following correct syntax. Hence, nothing will happen, and it might however, throw an error that the syntax is wrong.

Explanation:

int[15]=20 is a wrong syntax, and hence nothing will happen or computer might throw an error like that not correct syntax is being used. And if we write values[15]=20,  It will certainly throw ArrayIndexOutOfBoundsException as the maximum length is fixed to 15 and values[14] and not more than that.  

3 0
4 years ago
The length, height, and width of a cube are 10, 7, and 5 cm respectively. Write a program that calculates the volume, perimeter,
RideAnS [48]

Answer:

// code in C++.

#include <bits/stdc++.h>

using namespace std;

// main function

int main()

{

   // variables

   int length=10,height=7,width=5;

   // find the volume of

   int vol=length*height*width;

   // find the surface area

   int sa=2*(length*width+length*height+height*width);

   // find the perimeter

   int peri=4*(length+width+height);

   // print the volume

   cout<<"Volume is: "<<vol<<" cm^3."<<endl;

   // print the surface area

   cout<<"Surface area is: "<<sa<<" cm^2."<<endl;

   // print the perimeter

   cout<<"Perimeter is: "<<peri<<" cm."<<endl;

return 0;

}

Explanation:

Declare and initialize length=10, width=5 and height=7.calculate volume by multiply length, width and height and assign to variable "vol".Then find the surface area as 2*(length*width+length*height+height*width) and assign it to variable "sa".Then find the perimeter as 4*(length+width+height) and assign to variable "peri". Print the volume, perimeter and surface area.

Output:

Volume is: 350 cm^3.

Surface area is: 310 cm^2.

Perimeter is: 88 cm.

8 0
4 years ago
Which of the following are cloud computing resources?
aleksandr82 [10.1K]
All of the above because it is accessible through computer access if you were to download them to any type of iCloud work
3 0
3 years ago
Read 2 more answers
A database design where certain data entities are combined, summary totals are carried in the data records rather than calculate
uranmaximum [27]

Answer: Planned data redundancy

Explanation: Planned data redundancy is the problem that occurs in the single database where the same data unit gets stored in two different places. Data redundancy can acquire unnecessary space of the database.

Planned data redundancy can effect the processing and make modification of the data difficult. It can also create the corruption in the database .Thus , the definition mentioned in the question of data redundancy.

5 0
3 years ago
Henry Ford would have been most interested to bring which modern innovation to his automotive factories?
kondor19780726 [428]
Henry Ford would have been most interested to bring assembly lines which is an modern innovation to his autmotive factories. Although Henry Ford didn't invent cars he developed assembly lines
3 0
3 years ago
Read 2 more answers
Other questions:
  • Walt needs to ensure that messages from a colleague in another organization are never incorrectly identified as spam. What shoul
    14·2 answers
  • Which type of energy conversion is an electric generator designed to perform?
    8·1 answer
  • Computer communications describes a process in which two or more computers or devices transfer ____.
    10·1 answer
  • Write a function findWithinThreshold that identifies the elements of a given array that are inside a threshold value. Takes the
    13·1 answer
  • Write a C++ program that consist
    5·1 answer
  • Write one similarity and one difference between '_' (underscore) ' % ' wildcard symbol .
    11·1 answer
  • Write a program that first reads in the name of an input file and then reads the input file using the file.readlines() method. T
    7·1 answer
  • Helppppp meeee eeeeeee eee
    6·2 answers
  • How to get an object from a container in java.
    11·1 answer
  • A vpn is used primarily for which purpose?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!