C# program to convert kilometers to miles

Views: 483   

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

using System;

class MainClass {
    public static void Main (string[] args) {
    Console.WriteLine ("Please enter kilometers:");
    double kilometers = Convert.ToDouble(Console.ReadLine());
    double miles = kilometers / 1.6;
    Console.WriteLine(miles + " Miles");
  }
}

Output:

Please enter kilometers:
 15
9.375 Miles
On By