Link to home
Start Free TrialLog in
Avatar of mostafa mahmoud
mostafa mahmoud

asked on

COSIEN IS NOT WORKING ON MY CODE

WHEN I USED THIS CODE
       ElseIf operation = 8 Then
            TextBox1.Text = Math.Cos(fo)

Open in new window

"FO "IS THE FRIST NUMPER TO WRITE
AND THIS ELSE IF IS IN EQUAL BUTTON FUNCTION
AND WHN I WRITE NUMBER 30 AND PRESS ON COS BUTTON IT GIVE ME 0.154251449887584
Avatar of John
John
Flag of Canada image

The answer you go is correct.  Cosine of 30 radians is 0.1542...   Convert your number to Radians first

1 Radian is 57.2958 degrees.
Avatar of Ark
    ' calculate cosine with angle in degrees
    Private Function Cosd(angle As Double) As Double
        Return Math.Cos(Rad(angle))
    End Function
    ' calculate sine with angle in degrees
    Private Function Sind(angle As Double) As Double
        Return Math.Sin(Rad(angle))
    End Function
    ' convert degrees to radians
    Private Function Rad(degrees As Double) As Double
        Return Math.PI * degrees / 180
    End Function

Open in new window

This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.