Ruby program to calculate circle circumference
Following program shows you how to calculate circle circumference.
In this program we get circle radius from user and calculate circumference using following formula
Circumference = 2 X PI X r
puts "Please enter the radius of circle:"
circleRadius = gets.to_f
circumferenceOfCircle = 2 * 22/7* circleRadius
puts "Circumference of circle is:#{circumferenceOfCircle}"
Output:
Please enter the radius of circle:
4
Circumference of circle is:24.0