Computer Science
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)
Python
Python Control Flow
68 Likes
Answer
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
Answered By
29 Likes
Related Questions
Write a program that asks the user for two numbers and prints Close if the numbers are within .001 of each other and Not close otherwise.
Write a short program to check whether square root of a number is prime or not.
Write a short program to input a digit and print it in words.
A year is a leap year if it is divisible by 4, except that years divisible by 100 are not leap years unless they are also divisible by 400. Write a program that asks the user for a year and prints out whether it is a leap year or not.