Related Tags

julia
math
communitycreator

# How to use the deg2rad method in Julia

Programming Bytes

### Overview

The deg2rad() method converts the given degree value to a radian value.

### Syntax

deg2rad(degree)
Julia's cos function syntax

### Parameter

This method takes the parameter degree. This represents the degree value for which the radian value is to be found.

### Return value

This method returns the radian value of the given degree.

### Code

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))")

### Explanation

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

julia
math
communitycreator

CONTRIBUTOR

Programming Bytes
RELATED COURSES

View all Courses

Keep Exploring

Learn in-demand tech skills in half the time 