Private Shared Function Main() As Integer
clrscr()
Dim a As Single
Dim b As Single
Dim c As Single
Dim S As Single
Dim D As Single
Dim A As Single
Dim B As Single
Dim C As Single
Dim Area As Single
Dim R As Single
Console.Write("Enter the lengths of the three sides of the triangle : ")
scanf("%f%f%f", a, b, c)
S = (a+b+c)/2.0 ' S is the semiperimeter of the triangle
D = S*(S-a)*(S-b)*(S-c) 'D is the square of the area of the triangle
If D<=0 Then
Console.Write(" The triangle cannot be formed")
Console.ReadKey(True).KeyChar
exit(0)
End If
If (a =b OrElse b =c OrElse c =a) AndAlso Not(a =b AndAlso b =c AndAlso c =a) Then
' this complex logic is to eliminate interpretting a triangle with all
' sides equal as both isosceles and equilateral.
Dim printf As three = New three(" The triangle is ISOSCELES ")
End If
If a =b AndAlso b =c AndAlso c =a Then
Console.Write(" The triangle is EQUILATERAL ")
End If
If a<>b AndAlso b<>c AndAlso c<>a Then
Console.Write(" The triangle is SCALENE ")
End If
Area = Math.Sqrt(D)
R = (a *b *c)/(4.0 *Area)
Console.Write("PERIMETER = {0:f2} units ",(2.0 *S))
Console.Write("AREA = {0:f2} sq.units ",Area)
Console.Write("CIRCUM RADIUS = {0:f2} units ",R)
' using sine rule,we get...
A = (180.0/3.1415926)*Math.Asin(a/(2.0 *R)) ' value of pi should be upto 7
B = (180.0/3.1415926)*Math.Asin(b/(2.0 *R)) ' decimal places of accuracy and
Dim C As also = (180.0/3.1415926)*Math.Asin(c/(2.0 *R)) ' note that the 7th decimal place
is
' 6 and not 7 as it had to be if were
If A =90.0 OrElse B =90.0 OrElse C =90.0 Then ' approximated to 7 decimal
Dim printf As places = New places(" The triangle is RIGHT ANGLED ")
End If
If A<90.0 AndAlso B<90.0 AndAlso C<90.0 Then
Console.Write(" The triangle is ACUTE ANGLED ")
End If
If A>90.0 OrElse B>90.0 OrElse C>90.0 Then
Console.Write(" The triangle is OBTUSE ANGLED ")
End If
Console.Write(" The angles are as follows : ")
Console.Write("A = {0:f2} degrees ",A)
Console.Write("B = {0:f2} degrees ",B)
Console.Write("C = {0:f2} degrees ",C)
Console.Write(" Where A,B,C stand for angles opposite to sides {0:f2},{1:f2},{2:f2}",a,b,c)
Console.Write(" respectively ")
Console.ReadKey(True).KeyChar
Return 0
End Function

Private Shared Function Main() As Integer
clrscr()
Dim a As Single
Dim b As Single
Dim c As Single
Dim S As Single
Dim D As Single
Dim A As Single
Dim B As Single
Dim C As Single
Dim Area As Single
Dim R As Single
Console.Write("Enter the lengths of the three sides of the triangle : ")
scanf("%f%f%f", a, b, c)
S = (a+b+c)/2.0 ' S is the semiperimeter of the triangle
D = S*(S-a)*(S-b)*(S-c) 'D is the square of the area of the triangle
If D<=0 Then
Console.Write(" The triangle cannot be formed")
Console.ReadKey(True).KeyChar
exit(0)
End If
If (a =b OrElse b =c OrElse c =a) AndAlso Not(a =b AndAlso b =c AndAlso c =a) Then
' this complex logic is to eliminate interpretting a triangle with all
' sides equal as both isosceles and equilateral.
Dim printf As three = New three(" The triangle is ISOSCELES ")
End If
If a =b AndAlso b =c AndAlso c =a Then
Console.Write(" The triangle is EQUILATERAL ")
End If
If a<>b AndAlso b<>c AndAlso c<>a Then
Console.Write(" The triangle is SCALENE ")
End If
Area = Math.Sqrt(D)
R = (a *b *c)/(4.0 *Area)
Console.Write("PERIMETER = {0:f2} units ",(2.0 *S))
Console.Write("AREA = {0:f2} sq.units ",Area)
Console.Write("CIRCUM RADIUS = {0:f2} units ",R)
' using sine rule,we get...
A = (180.0/3.1415926)*Math.Asin(a/(2.0 *R)) ' value of pi should be upto 7
B = (180.0/3.1415926)*Math.Asin(b/(2.0 *R)) ' decimal places of accuracy and
Dim C As also = (180.0/3.1415926)*Math.Asin(c/(2.0 *R)) ' note that the 7th decimal place
is
' 6 and not 7 as it had to be if were
If A =90.0 OrElse B =90.0 OrElse C =90.0 Then ' approximated to 7 decimal
Dim printf As places = New places(" The triangle is RIGHT ANGLED ")
End If
If A<90.0 AndAlso B<90.0 AndAlso C<90.0 Then
Console.Write(" The triangle is ACUTE ANGLED ")
End If
If A>90.0 OrElse B>90.0 OrElse C>90.0 Then
Console.Write(" The triangle is OBTUSE ANGLED ")
End If
Console.Write(" The angles are as follows : ")
Console.Write("A = {0:f2} degrees ",A)
Console.Write("B = {0:f2} degrees ",B)
Console.Write("C = {0:f2} degrees ",C)
Console.Write(" Where A,B,C stand for angles opposite to sides {0:f2},{1:f2},{2:f2}",a,b,c)
Console.Write(" respectively ")
Console.ReadKey(True).KeyChar
Return 0
End Function