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
What are building blocks? select three options.
mr Goodwill [35]

Answer:

Content that has been formatted

Content that is stored as templates

Content that is stored in galleries

Explanation:

These are the answers because that’s just what they are

7 0
4 years ago
Suppose there is a text file named "datafile.txt with some data in the root directory of your computer". Using your choice of la
aivan3 [116]

Answer:

See explaination for program code

Explanation:

code below

using System;

using System.IO;

namespace ReadAndDisplayFileCOnsole

{

class Program

{

static void Main(string[] args)

{

using (StreamReader reader = new StreamReader("D:\\datafile.txt"))

{

while (true)

{

string line = reader.ReadLine();

if (line == null)

{

break;

}

Console.WriteLine(line);

}

reader.Close();

Console.Read();

}

}

}

}

6 0
3 years ago
What is the outlined area called?
LenKa [72]

Answer:

If you're talking about perimeter (the length of the outer edges)

Explanation:

6 0
4 years ago
Kahnacademy sucksi am so mad i want to k ..<br> ill myself
ehidna [41]
No don’t do thattt ….
4 0
3 years ago
What kind of communications device sends and receives data and information to and from a digital line, such as isdn and cable?
stiks02 [169]
The communication device that <span>sends and receives data and information to and from a digital line, such as ISDN and cable is the broadband modem, or also called digital modem, in a case when the line is digital. If the line is ISDN than the modem is called ISDN modem. </span>
3 0
3 years ago
Other questions:
  • When typing in a cell, hitting Tab will bring which result?
    12·2 answers
  • Keep getting the message i failed to sign in to email on my phone but i can open my email. whats going on?
    10·2 answers
  • Consider whether there are additional components that could be added to the IPv4 protocol to enhance its usefulness. What are th
    15·1 answer
  • Please label the parts its urgent Best answer receives a brainliest and 20 points please i need it :) :) ​
    5·2 answers
  • Gloria is in her sophomore year of college and works part time. She has assignments saved on her home computer, her aunt's lapto
    6·2 answers
  • Read the integer numbers in the text file "1000 Random Number from 0 to 100.txt" into a list
    6·1 answer
  • Which type of image would require you to obtain permission from the author to use the image and possibly pay a royalty to the au
    12·1 answer
  • I have crummy WiFi and a bad pc. If I get a gaming computer, will it improve my FPS or ping?
    14·2 answers
  • Hurry please I’ll give Brainliest if you are right
    5·1 answer
  • 1. What is a word processor program?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!