Using python The sum of any two side lengths of a triangle m

Using python The sum of any two side lengths of a triangle must always be greater than the third side. Write a program that prompts the user to enter three dimensions and then determines if a triangle can be constructed with them.

Solution

Code:

# your code goes here
x = int(input(\'Enter the first side\'))
y = int(input(\'Enter the second side\'))
z = int(input(\'Enter the third side\'))

if((x>(y+z)) or (y>(x+z)) or (z>(x+y))):
   print(\'Triangle can be made using three sides\')
else:
   print(\'Triangle cannot be made using given three sides\')

Input:

2

3

7

Output:

Triangle can be made using three sides

Link to code:

http://ideone.com/n42HoH

Hope it helps, do give your response.

Using python The sum of any two side lengths of a triangle must always be greater than the third side. Write a program that prompts the user to enter three dime

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site