logo image

Python program to calculate triangle circumference

87


Following program shows you how to calculate triangle circumference. This program gets triangle sides from user and calculates circumference and prints it using following formula Circumference = side1 + side2 + side3

triangleSide1 = float(input("Enter the side1 of triangle:"))
triangleSide2 = float(input("Enter the side2 of triangle:"))
triangleSide3 = float(input("Enter the side3 of triangle:"))
circumferenceOfTriangle = triangleSide1 + triangleSide2 + triangleSide3
print("Circumference of triangle is: ", circumferenceOfTriangle)

Output:

Enter the side1 of triangle: 17
Enter the side2 of triangle: 22
Enter the side3 of triangle: 18
Circumference of triangle is:  57.0