Home >>VB.Net Programs >VB.Net Program to find the tangent value for the specified angle

VB.Net Program to find the tangent value for the specified angle

Write a VB.Net program to find the tangent value for the specified angle

Here, for the defined angle, we can find the tangent value and print the result on the console screen.

Program :

Below is the source code for determining the tangent value for the angle defined. The program given is compiled and successfully executed.

Example


Module Module1

    Sub Main()
        Dim tangent As Double = 0

        tangent = Math.Tan(2)
        Console.WriteLine("Tangent is: {0}", tangent)

        tangent = Math.Tan(0.3584)
        Console.WriteLine("Tangent is: {0}", tangent)

        tangent = Math.Tan(0.0)
        Console.WriteLine("Tangent is: {0}", tangent)
    End Sub
    
End Module
	
Output:
Tangent is: -2.18503986326152
Tangent is: 0.374577262964287
Tangent is: 0

Explanation:

We created a Module1 module in the program above that contains the Main() method. We generated a variable tangent initialized with 0 in the Main() method.

tangent = Math.Tan(2)
Console.WriteLine("Tangent is: {0}", tangent)

tangent = Math.Tan(0.3584)
Console.WriteLine("Tangent is: {0}", tangent)

tangent = Math.Tan(0.0)
Console.WriteLine("Tangent is: {0}", tangent)

In the above code, for the defined angle values, the tangent value is found and then printed on the console screen.


No Sidebar ads