角度弧度转换代码

2014-10-30 0 898
角度弧度转换代码
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

遇见资源网 ruby 角度弧度转换代码 http://www.ox520.com/16155.html

常见问题

相关文章

发表评论
暂无评论
官方客服团队

为您解决烦忧 - 24小时在线 专业服务