logo image

Ruby program to convert kilometers to miles

Following program shows you how to convert kilometers to miles. In this program we get kilometers from user, once we get those we need to divide with 1.6 so that we get in milles

puts "Please enter kilometers:"
 kilometers = gets.to_f
 miles = kilometers / 1.6
 puts "#{miles} Miles"


Please enter kilometers:
6.25 Miles