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

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

Finding the cosine value for the specified angle

Here, we will find the cosine value for the specified angle and print the result on the console screen.

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

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

'VB.Net program to find the cosine of 
'the specified angle.

Module Module1

    Sub Main()
        Dim cosine As Double = 0

        cosine = Math.Cos(2)
        Console.WriteLine("Cosine is: {0}", cosine)

        cosine = Math.Cos(0.3584)
        Console.WriteLine("Cosine is: {0}", cosine)

        cosine = Math.Cos(0.0)
        Console.WriteLine("Cosine is: {0}", cosine)
    End Sub
    
End Module

Output:

Cosine is: -0.416146836547142
Cosine is: 0.93645926426301
Cosine is: 1
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 cosine initialized with 0.

cosine = Math.Cos(2)
Console.WriteLine("Cosine is: {0}", cosine)

cosine = Math.Cos(0.3584)
Console.WriteLine("Cosine is: {0}", cosine)

cosine = Math.Cos(0.0)
Console.WriteLine("Cosine is: {0}", cosine)

In the above code, we find the cosine value for the specified angle 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.