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
Eddi Din [679]
2 years ago
10

In a right triangle, the square of the length of one side is equal to the sum of the squares of the lengths of the other two sid

es. Write a program that prompts the user to enter the lengths of three sides of a triangle and then outputs a message indicating whether the triangle is a right triangle. Assume the user does not know the hypotenuse. You may NOT ask the user for the hypotenuse. Meaning, you have to check all 3 sides to verify that it is a right-angled triangle.
Engineering
1 answer:
Dovator [93]2 years ago
8 0

Answer:

C++ code is explained below

Explanation:

/Remove the following line

//if not using visual studio.

#include "stdafx.h"

//Import the required header files.

#include <iostream>

using namespace std;

//Define the main function.

int main(void)

{

    //Define the variables.

    double side1, side2, side3;

    //Prompt the user to enter the sides of the triangle.

    cout << "Enter the side of the triangle:" << endl;

    cout << "Enter first side of triangle:" << endl;

    cin >> side1;

    cout << "Enter second side of triangle:" << endl;

    cin >> side2;

    cout << "Enter third side of triangle:" << endl;

    cin >> side3;

    cout << endl;

    //Check if the triangle sides are valid

    if ((side1 + side2 > side3) &&

         (side1 + side3 > side2) &&

         (side2 + side3 > side1))

    {

         //Check the condition for right angle triangle

         if ((side3*side3 == (side1*side1 + side2*side2)) ||

             (side2*side2 == (side3*side3 + side1*side1)) ||

             (side1*side1 == (side3*side3 + side2*side2)))

//Display that the triangle is right-angled triangle.

             cout << "It is a right-angled triangle." << endl;

         else

//Display that the triangle is not the right-//angled triangle.

             cout << "It is not a right-angled triangle."

<< endl;

    }

    else

         //Display not the valid side.

         cout << "Not a valid side." << endl;

    //Remove the following line if

    //not using visual studio.

    system("pause");

    return 0;

}

You might be interested in
Before finishing and installing a shelved cabinet you just constructed, you need to check the
Greeley [361]

Answer:

Carpenter's square

Explanation:

The most common hand tool used to measure or set angles with its application extending to setting angles of roofs and rafters. Another name of a Carpenter's square is a framing square.

Other hand tools that are used to measure angles are;

  • The combination square that allows a user to set both 90°  and 45° angles
  • A Bevel that allows users to set any angle they like.
  • A Protractor that resembles a bevel but its marks are marked in an arc.
  • An electromagnetic angle finder which gives a reading according to the measure of the arms adjusted by the user.
7 0
2 years ago
Say you have a random, unordered list containing 4096 four-digit numbers. Describe the most efficient way to: sort the list and
Debora [2.8K]

Answer:

Answer explained below

Explanation:

It is given that numbers are four-digit so maximum value of a number in this list could be 9999.

So we need to sort a list of integers, where each integer lies between [0,9999].

For these given constraints we can use counting sort which will run in linear time i.e. O(n).

--------------------------------------------------------------------------------

Psuedo Code:

countSort(int numList[]) {

int count[10000];

count[i] = 0; for all i;

for(int num in numList){

count[num]+= 1;

}

return count;

}

--------------------------------------------------------------------------------

Searching in this count array will be just O(1).

E.g. Lets say we want to search if 3 was present in the original list.

Case 1: it was present in the original list:

Then the count[3] would have been incremented by our sorting algorithm. so in case element exists then count value of that element will be greater than 0.

Case 2: it was not present:

In this case count[3] will remain at 0. so in case element does not exist then count of that element will be 0.

So to search for an element, say x, we just need to check if count[x]>0.

So search is O(1).

Run times:

Sorting: O(n)

Search: O(1)

6 0
3 years ago
Draw the schematics for the following two battery connections. Can you explain the value of the output voltage in the series con
matrenka [14]

if two 1.5 ya alt batteries are connected to head to the tail the voltage is 3.0 volt it is the because the battery is insidious reduce a voltage equal to number of battery is multiplied by the voltage of individual

5 0
2 years ago
Milk has a density of as much as 64.6 lb/ft3. What is the gage pressure at the bottom of the straw 6.1 inches deep in the milk?
gregori [183]

Answer:

Explanation:

1 inch is 0.0833333feet

6.1 inches is 0.5083 feet

Density = mass/volume

64.6 = mass/0.50833

mass = 64.6 x 0.5083 =32.83618lb

3 0
2 years ago
Gas is kept in a 0.1 m diameter cylinder under the weight of a 100 kg piston that is held down by a spring with a stiffness k =
Artyom0805 [142]

Answer:

The spring is compressed by 0.275 meters.

Explanation:

For equilibrium of the gas and the piston the pressure exerted by the gas on the piston should be equal to the sum of  weight of the piston and the force the spring exerts on the piston

Mathematically we can write

Force_{pressure}=Force_{spring}+Weight_{piston}

we know that

Force_{pressure}=Pressure\times Area=300\times 10^{3}\times \frac{\pi \times 0.1^2}{4}=750\pi Newtons

Weight_{piston}=mass\times g=100\times 9.81=981Newtons

Now the force exerted by an spring compressed by a distance 'x' is given by Force_{spring}=k\cdot x=5\times 10^{3}\times x

Using the above quatities in the above relation we get

5\times 10^{3}\times x+981=750\pi \\\\\therefore x=\frac{750\pi -981}{5\times 10^{3}}=0.275meters

5 0
2 years ago
Other questions:
  • ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
    9·1 answer
  • Consider an InSb NW with ballistic mean free path of 150nm. Calculate the current through a 250nm long InSb NW when a 100mV bias
    6·1 answer
  • There have been many attempts to manufacture and market plastic bicycles. All have been too flexible and soft. Which design-limi
    9·1 answer
  • he ventilating fan of the bathroom of a building has a volume flow rate of 28 L/s and runs continuously. If the density of air i
    9·1 answer
  • A wine aerator is a small, in-bottle, hand-held pour-through or decantor top device using the venturi effect for aerating the wi
    9·1 answer
  • A plot of land is an irregular trangle with a base of 122 feet and a height of 47 feet what is the area of the plot?
    13·1 answer
  • 53. The plan of a building is in the form of a rectangle with
    13·1 answer
  • Método de Programación lineal utilizado para resolver problemas en teoría de redes?
    15·1 answer
  • People learn best in different ways. By combining all the group presentations, your class will explain how they see the optical
    8·2 answers
  • A cross beam in a highway bridge experiences a stress of 14 ksi due to the dead weight of the bridge structure. When a fully loa
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!