三角形是一個基本的幾何形狀,且有著神祕的特質,例如構成三角形的條件必須為任兩邊相加要大於第三邊。
請寫一個程式,讓使用者輸入三個邊長,並判斷是否可以組成三角形。


➥a = int(input("請輸入a邊長:"))
➥b = int(input("請輸入b邊長:"))
➥c = int(input("請輸入c邊長:"))
➥if ((a+b>c) and (a+c>b) and (b+c>a)):
➥ print("可以構成三角形")
➥else:
➥ print("不能構成三角形")

➥a = int(input("請輸入a邊長:"))
➥b = int(input("請輸入b邊長:"))
➥c = int(input("請輸入c邊長:"))
➥if ((a+b>c) and (a+c>b) and (b+c>a)):
➥ print("可以構成三角形")
➥else:
➥ print("不能構成三角形")

程式執行結果顯示:
FlowInfo1 FlowInfo2 FlowInfo3 FlowInfo4 FlowInfo5