VelizarAvramov

03. Miles to Kilometers

Jul 17th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.43 KB | None | 0 0
  1. Write a program, which converts miles to kilometers. Format the output to the 2nd decimal place.
  2. Note: 1 mile == 1.60934 kilometers
  3. using System;
  4.  
  5. namespace _03._Miles_to_Kilometers
  6. {
  7.     class MilesToKm
  8.     {
  9.         static void Main(string[] args)
  10.         {
  11.             double miles = double.Parse(Console.ReadLine());
  12.  
  13.             double km = 1.60934 * miles;
  14.             Console.WriteLine($"{km:f2}");
  15.         }
  16.     }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment