返回顶部

收藏

角度弧度转换代码

更多

[Ruby]代码

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/rails

收藏

0人收藏

支持

0

反对

0

发表评论