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
Advocard [28]
3 years ago
6

Input 3 positive integers from the terminal, determine if tlrey are valid sides of a triangle. If the sides do form a valid tria

ngle, output the type of triangle - equilateral, isosceles, or scalene - and the area of the triangle. If the three integers are not the valid sides of a triangle, output an appropriats message and the 3 sides. Be sure to comment and error check in your progam.
Computers and Technology
1 answer:
butalik [34]3 years ago
4 0

Answer:

In Python:

side1 = float(input("Side 1: "))

side2 = float(input("Side 2: "))

side3 = float(input("Side 3: "))

if side1>0 and side2>0 and side3>0:

   if side1+side2>=side3 and side2+side3>=side1 and side3+side1>=side2:

       if side1 == side2 == side3:

           print("Equilateral Triangle")

       elif side1 == side2 or side1 == side3 or side2 == side3:

           print("Isosceles Triangle")

       else:

           print("Scalene Triangle")

   else:

       print("Invalid Triangle")

else:

   print("Invalid Triangle")

Explanation:

The next three lines get the input of the sides of the triangle

<em>side1 = float(input("Side 1: ")) </em>

<em>side2 = float(input("Side 2: ")) </em>

<em>side3 = float(input("Side 3: ")) </em>

If all sides are positive

if side1>0 and side2>0 and side3>0:

Check if the sides are valid using the following condition

   if side1+side2>=side3 and side2+side3>=side1 and side3+side1>=side2:

Check if the triangle is equilateral

<em>        if side1 == side2 == side3: </em>

<em>            print("Equilateral Triangle") </em>

Check if the triangle is isosceles

<em>        elif side1 == side2 or side1 == side3 or side2 == side3: </em>

<em>            print("Isosceles Triangle") </em>

Otherwise, it is scalene

<em>        else: </em>

<em>            print("Scalene Triangle") </em>

Print invalid, if the sides do not make a valid triangle

<em>    else: </em>

<em>        print("Invalid Triangle") </em>

Print invalid, if the any of the sides are negative

<em>else: </em>

<em>    print("Invalid Triangle")</em>

You might be interested in
Can someone answer these 2 please
Leto [7]

Answer:

c for the first one and d for the secound one

Explanation:

5 0
2 years ago
How can I convert a string to a int? in Java
Deffense [45]

Answer:

int

Explanation:

5 0
2 years ago
Most network cards contain a port that accepts a(n) ____, which looks similar to a telephone connector but is larger.
Vadim26 [7]
YOUR ANSWER IS -------- It accepts a RJ-45 connector
hope i helped you :).
take care
8 0
3 years ago
Given the following code fragment and the input value of 4.0, what output is generated?
kicyunya [14]

Answer:

c) 4.4

Explanation:

You can evaluate step by step the code. You know tha your input is 4.0

Step 1 Variables definitions:

double tax;

double total;

Step 2 Ask the user for the input:

System.out.print("Enter the cost of the item");

Step 3 read de input:

total = scan.nextDouble();

Step 4 evaluate the condition (  is the input greater or equal  than 3.0 ? [True])

if ( total >= 3.0)

Step 5 get done the operations inside the condition and print it:

tax = 0.10;

System.out.println(total + (total * tax));

4 0
3 years ago
Which sql keyword is used to retrieve a minimum value from an attribute in a table
konstantin123 [22]

The SQL keyword that is often used to retrieve a minimum value from an attribute in a table is the MIN function.

<h3>What is the MIN Function? </h3>

The MIN Function is known to be a group found under Excel Statistical functions.

Note that the MIN often return the minimum value in any list of arguments and as such The SQL keyword that is often used to retrieve a minimum value from an attribute in a table is the MIN function.

Learn more about SQL from

brainly.com/question/25694408

#SPJ11

5 0
2 years ago
Read 2 more answers
Other questions:
  • give two main reasons that should be considered when preparing and deploying a functional restoral scenario.
    5·1 answer
  • Select the properties of the sn1 reaction mechanism.
    9·1 answer
  • \Read the sentence.
    12·1 answer
  • Why was the first computer developed? a.) for personal use, b.) for military purposes, c.) for transportation, d.) for communica
    5·1 answer
  • After a suspected identity fraud case has been resolved, you should:
    10·2 answers
  • Explain what middleware is. Name a common middleware in two-tier client/server architecture for database applications.
    10·1 answer
  • If you had an idea for a new software company, what would be the best approach to help make it a successful business? develop a
    5·2 answers
  • Which is the most popular language used in game programming?
    5·2 answers
  • A printer is considered to be in the category of
    5·2 answers
  • How can structure of a table change in sql. What general types of changes are possible
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!