The deg2rad()
method converts the given degree value to a radian value.
deg2rad(degree)
This method takes the parameter degree
. This represents the degree value for which the radian value is to be found.
This method returns the radian value of the given degree.
The code below demonstrates how to use the deg2rad
method:
## find radian of 0 degree degree = 0 println( "Radian value of $(degree) degree is : $(deg2rad(degree))") ## find radian of 10 degree degree = 10 println( "Radian value of $(degree) degree is : $(deg2rad(degree))")
Line 2: We create a new variable degree and assign 0
to it.
Line 3: We use the deg2rad
method with the degree
variable as an argument. This method converts the degree to radians. The radian value of 0 degrees is 0.0.
Line 6: We assign 10
as the value for the degree
variable.
Line 7: We use the deg2rad
method with the degree
variable as an argument. This method converts the degree to radians. The radian value of 10 degrees is 0.17453292519943295.
RELATED TAGS
CONTRIBUTOR
View all Courses