Open In App

Convert degree to radian and radian to degree in Julia – deg2rad() and rad2deg() Methods

Last Updated : 21 Apr, 2020
Improve
Improve
Like Article
Like
Save
Share
Report

The deg2rad() is an inbuilt function in julia which is used to convert the specified degree values to radian values.

Syntax: deg2rad(x)

Parameters:

  • x: Specified value in degree.

Returns: It returns the values in radian.

Example:




# Julia program to illustrate 
# the use of deg2rad() method
  
# Getting the values in radian
println(deg2rad(0))
println(deg2rad(30))
println(deg2rad(50))
println(deg2rad(60))


Output:

0.0
0.5235987755982988
0.8726646259971648
1.0471975511965976

rad2deg()

The rad2deg() is an inbuilt function in julia which is used to convert the specified radian values to degree values.

Syntax: rad2deg(x)

Parameters:

  • x: Specified values in radian.

Returns: It returns the values in degree.

Example:




# Julia program to illustrate 
# the use of rad2deg() method
  
# Getting the values in degree
println(rad2deg(pi))
println(rad2deg(3.14))
println(rad2deg(22 / 7))


Output:

180.0
179.9087476710785
180.07244989825872

Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads