Programming Examples

Python program to input length of three sides of a triangle Then check if these sides will form a triangle or not


Write a program to input length of three sides of a triangle. Then check if these sides will form a triangle or not.

(Rule is: a+b>c;b+c>a;c+a>b)

Solution

a = int(input("Enter first side : "))
b = int(input("Enter second side : "))
c = int(input("Enter third side : "))

if a + b > c and b + c > a and a + c > b :
    print("Triangle Possible")
else :
    print("Triangle Not Possible")
Output

Enter first side : 3

Enter second side : 5

Enter third side : 6

Triangle Possible

CCC Online Test 2021 CCC Practice Test Hindi Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Best Java Training Institute in Prayagraj (Allahabad) Best Python Training Institute in Prayagraj (Allahabad) O Level Online Test in Hindi Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Sarkari Naukari Notification Best Website and Software Company in Allahabad Sarkari Exam Quiz