Skip to content
Related Articles

Related Articles

Convert degree to radian and radian to degree in Julia – deg2rad() and rad2deg() Methods
  • Last Updated : 21 Apr, 2020

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

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.

My Personal Notes arrow_drop_up
Recommended Articles
Page :