Write a Ruby program which accept the radius of the sphere as input and compute the volume.
Ruby Code:
r = 5.0 v = 0.0 pi = 3.141592653 print "Input the radius of the circle: " r = gets.to_f v = (4/3)* (pi)* (r**3) puts "The volume of the sphere is : #{v}."
Input the radius of the circle: The volume of the sphere is : 392.699081625.
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
Ruby Code: