VB.Net program to find the angle for specified cosine value

Here, we are going to learn how to find the angle for specified cosine value in VB.Net?
Submitted by Nidhi, on December 02, 2020 [Last updated : February 18, 2023]

Finding the angle for specified cosine value

Here, we will find the angle for the specified cosine value and print the angle values for different cosine values.

VB.Net code to find the angle for specified cosine value

The source code to find the angle for specified cosine value is given below. The given program is compiled and executed successfully.

'VB.Net program to find the angle for 
'specified cosine value.

Module Module1

    Sub Main()
        Dim angle As Double= 0

        angle = Math.Acos(2)
        Console.WriteLine("Angle of specified cosine value is: {0}", angle)

        angle = Math.Acos(0.3584)
        Console.WriteLine("Angle of specified cosine value is: {0}", angle)

        angle = Math.Acos(0.0)
        Console.WriteLine("Angle of specified cosine value is: {0}", angle)
    End Sub

End Module

Output:

Angle of specified cosine value is: NaN
Angle of specified cosine value is: 1.20424285296577
Angle of specified cosine value is: 1.5707963267949
Press any key to continue . . .

Explanation:

In the above program, we created a module Module1 that contains the Main() method. In the Main() method we created a variable angle initialized with 0.

angle = Math.Acos(2)
Console.WriteLine("Angle of specified cosine value is: {0}", angle)

angle = Math.Acos(0.3584)
Console.WriteLine("Angle of specified cosine value is: {0}", angle)

angle = Math.Acos(0.0)
Console.WriteLine("Angle of specified cosine value is: {0}", angle)

In the above code, we find the angle against the specified cosine values and then printed them on the console screen.

VB.Net Basic Programs »





Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.