C# program to convert miles to kilometers

Views: 631   

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

using System;

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

Output:

Please enter miles:
 30
48 Kilometers
On By