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
frozen [14]
3 years ago
12

Integers and booleans. Write a program RightTriangle that takes three int command-line arguments and determines whether they con

stitute the side lengths of some right triangle. right triangle The following two conditions are necessary and sufficient: Each integer must be positive. The sum of the squares of two of the integers must equal the square of the third integer.
Computers and Technology
1 answer:
icang [17]3 years ago
4 0

Answer:

<em>The programming language is not stated;</em>

<em>I'll answer using C++</em>

#include<iostream>

#include<cmath>

using namespace std;

int main()

{

int side1, side2, side3;

cout<<"Enter the three sides of the triangle: "<<endl;

cin>>side1>>side2>>side3;

if(side1<=0 || side2 <= 0 || side3 <= 0) {

 cout<<"Invalid Inputs";

}

else {

 if(abs(pow(side1,2) - (pow(side2,2) + pow(side3, 2)))<0.001) {

  cout<<"Right Angled";

 }

 else if(abs(pow(side2,2) - (pow(side1,2) + pow(side3, 2)))<0.001) {

  cout<<"Right Angled";

 }

 else if(abs(pow(side3,2) - (pow(side2,2) + pow(side1, 2)))<0.001) {

  cout<<"Right Angled";

 }

 else {

  cout<<"Not Right Angled";

 }

}

return 0;

}

Explanation:

The following line declares the three variables

int side1, side2, side3;

The next line prompts user for input of the three sides

cout<<"Enter the three sides of the triangle: "<<endl;

The next line gets user input

cin>>side1>>side2>>side3;

The following if condition checks if any of user input is negative or 0

<em> if(side1<=0 || side2 <= 0 || side3 <= 0) { </em>

<em>  cout<<"Invalid Inputs"; </em>

<em> } </em>

If otherwise

else {

The following if condition assumes that side1 is the largest and test using Pythagoras Theorem

<em>if(abs(pow(side1,2) - (pow(side2,2) + pow(side3, 2)))<0.001) { </em>

<em>   cout<<"Right Angled"; </em>

<em>  } </em>

The following if condition assumes that side2 is the largest and test using Pythagoras Theorem

<em>  else if(abs(pow(side2,2) - (pow(side1,2) + pow(side3, 2)))<0.001) { </em>

<em>   cout<<"Right Angled"; </em>

<em>  } </em>

The following if condition assumes that side3 is the largest and test using Pythagoras Theorem

<em>  else if(abs(pow(side3,2) - (pow(side2,2) + pow(side1, 2)))<0.001) { </em>

<em>   cout<<"Right Angled"; </em>

<em>  } </em>

If none of the above conditions is true, then the triangle is not a right angles triangle

<em>  else { </em>

<em>   cout<<"Not Right Angled"; </em>

<em>  } </em>

}

return 0;

Download cpp
You might be interested in
What is the purpose of the website directory provided by the website host?
Dennis_Churaev [7]

Answer:

mabye A

Explana

.

.

.

6 0
3 years ago
At your job, you often have to address letters to the customer support manager, Tyson Kajewski. The problem is that you are cons
krek1111 [17]
Input his name in the dictionary function, you can also copy the given name an paste as much as you need
5 0
3 years ago
Which of the following kinds of software is a sophisticated type of application software that assists a professional user in cre
Setler [38]

Answer:

The answer is A. CAD which means Computer-Aided Design.

Explanation:

CAD is used for creating different designs, simulations and scientific diagrams, some examples of CAD software include AutoCAD and Solidworks.

For reference the other acronyms mean:

Desktop publishing (DTP)

Computer-based training (CBT)

Web-based training (WBT)

4 0
3 years ago
click the view lab button. restart the computer and press the f2 or delete key on your keyboard to enter the bios setup program.
IgorLugansk [536]

The brand of processor that is known to be installed are:

  • Intel
  • 4096
  • 1610
  • -3
  • Enabled
  • -Diskette Drive

<h3>What a processor means?</h3>

A processor (CPU) is known to be a kind of logic circuitry that  is known to answer to and work on the basic instructions that tends to drive a computer.

Note that the CPU is seen as the key  and most crucial integrated circuitry (IC) chip and the intel process is known to be one of the most common forms of processor.

Therefore, The brand of processor that is known to be installed are:

  • Intel
  • 4096
  • 1610
  • -3
  • Enabled
  • -Diskette Drive

Learn more about bios settings from

brainly.com/question/13103092

#SPJ1

Click the View Lab button. When the simulated computer starts, press the F2 or Delete key on your keyboard to enter the BIOS setup program. Explore the current BIOS settings to find the answers to the following questions.

What brand of processor is installed?

4 0
1 year ago
Name all the keys of the home row.
Kaylis [27]

Answer:

Search key, a, s, d, f, g, h, j, k, l, : and ;, ¨ and ´, and the enter key.

5 0
3 years ago
Other questions:
  • Templates allow for the quick creation of _____.
    7·1 answer
  • The series of events that make up a story is called
    6·2 answers
  • The counter in a for or while loop can have an explicit increment: for i=m:k:n. This advances the counter i by increment k each
    15·1 answer
  • Ladders are a fundamental piece of equipment on construction sites and employers are expected to ensure that workers follow safe
    5·1 answer
  • When a new word processing software program is released, companies that might use it must consider not only the cost of buying i
    13·1 answer
  • The elements in a long array of integers are roughly sorted in decreasing order. No more than 5 percent of the elements are out
    12·1 answer
  • Globalization is based on <br>​
    10·1 answer
  • Jill is configuring the AutoArchive feature in Outlook 2016. What is the default setting in relation to when AutoArchive
    8·1 answer
  • WILL GIVE BRAINLIEST! 20 POINTS! PLZ HELP!
    14·2 answers
  • From where do we get information or knowledge? Explain.
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!