Write a C# program that accepts distance in kilometers, converts it into meters, and then displays the result.
Sample Solution
C# Sharp Code
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication1 { class Meter_Kilometer { static void Main(string[] args) { int distance, Result; Console.WriteLine("Enter the distance in Kilometers"); distance = Convert.ToInt32(Console.ReadLine()); Result = distance * 1000; Console.WriteLine(" Distance in meters:" + Result); Console.ReadLine(); } } }
No comments:
Post a Comment