Q. Write a program to input length of three side of a triangle. then check if these side will form a triangle or not.


You can understand by Watching video :-



Answer :-

a = int (input ("Enter the first side of triangle = "))
b = int (input ("Enter the second side of triangle = "))
c = int (input ("Enter the third side of triangle = "))
if a < b + c and b < a + c and c < a + b :
  print ("It form the triangle")
else :
  print ("It can not form triangle")

Output :-

Enter the first side of triangle = 3
Enter the second side of triangle = 4
Enter the third side of triangle = 5
It form the triangle

>>> 

Enter the first side of triangle = 8
Enter the second side of triangle = 9
Enter the third side of triangle = 16
It form the triangle

>>>

Enter the first side of triangle = 8
Enter the second side of triangle = 1
Enter the third side of triangle = 2
It can not form triangle

>>>

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post