Ruby program to convert kilometers to miles

Views: 120   

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"

Output:

Please enter kilometers:
10
6.25 Miles
On By