suppose everybody is already familiar with the above Theorem.
However, some of your kids may not have learned this theorem yet.
So, let me list the formula here. By referring to a right angled
triangle ABC, if the sides are AB, AC and AC respectively,
where AC is the hypotenuse, then AB,AC and BC are
connected by the formula AB2+AC2=BC2
Using the above formula, you can calculate the third side if the the length of any two sides are know. For example, if AB=4 and AC=3 then BC=5. I have designed the VB program for the user to input any two sides and then he/she is able to calculate the third side automatically. I also used the function Round to round the values to two decimal places. The code is shown on the right.
The CodePrivate Sub Command1_Click()
Dim AB, AC, BC As Single
AB = Val(Txt_AB.Text)
AC = Val(Txt_AC.Text)
BC = Val(Txt_BC.Text)
If AB <> 0 And AC <> 0 Then
BC = Sqr(AB ^ 2 + AC ^ 2)
Txt_BC.Text = Round(BC, 2)
ElseIf AB <> 0 And BC <> 0 Then
AC = Sqr(BC ^ 2 - AB ^ 2)
Txt_AC.Text = Round(AC, 2)
ElseIf AC <> 0 And BC <> 0 Then
AB = Sqr(BC ^ 2 - AC ^ 2)
Txt_AB.Text = Round(AB, 2)
End If
End Sub
Using the above formula, you can calculate the third side if the the length of any two sides are know. For example, if AB=4 and AC=3 then BC=5. I have designed the VB program for the user to input any two sides and then he/she is able to calculate the third side automatically. I also used the function Round to round the values to two decimal places. The code is shown on the right.
The CodePrivate Sub Command1_Click()
Dim AB, AC, BC As Single
AB = Val(Txt_AB.Text)
AC = Val(Txt_AC.Text)
BC = Val(Txt_BC.Text)
If AB <> 0 And AC <> 0 Then
BC = Sqr(AB ^ 2 + AC ^ 2)
Txt_BC.Text = Round(BC, 2)
ElseIf AB <> 0 And BC <> 0 Then
AC = Sqr(BC ^ 2 - AB ^ 2)
Txt_AC.Text = Round(AC, 2)
ElseIf AC <> 0 And BC <> 0 Then
AB = Sqr(BC ^ 2 - AC ^ 2)
Txt_AB.Text = Round(AB, 2)
End If
End Sub
No comments:
Post a Comment