JavaScript program to convert kilometers to miles

6426


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 miles

var kilometers = parseInt(prompt("Please enter kilometers:"));
var miles = kilometers / 1.6;
console.log(miles + " Miles");

Output:

Please enter kilometers:
10
6.25 Miles