Programming Examples

Python program to input 3 sides of a triangle and print whether it is an equilateral scalene or isosceles triangle


Write a program to input 3 sides of a triangle and print whether it is an equilateral, scalene or isosceles triangle.

Solution

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

if a == b and b == c :
    print("Equilateral Triangle")
elif a == b or b == c or c == a:
    print("Isosceles Triangle")
else :
    print("Scalene Triangle")
Output/ Explanation:

Enter first side : 10

Enter second side : 5

Enter third side : 10

Isosceles Triangle

Latest Current Affairs 2024 Online Exam Quiz for One day Exam Online Typing Test CCC Online Test Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Online MBA 2 years Online MCA Online BCA Best Website and Software Company in Allahabad