角度弧度转换代码

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

def d2r()
  puts "Enter the value of angle in degree"
  t=gets.chomp.to_f
  #corresponding value in radian
  r=(3.14*t)/180
  puts "The value of given angle in radian is "+r.to_s
end

def r2d()
  puts "Enter the value of angle in radian:"
  r=gets.chomp.to_f
  #corresponding value in degree
  t=(180*r)/3.14
  puts "The value of given angle in degree is " +t.to_s
end