Monday 29 April 2013

Write a C# program that accepts distance in kilometers, converts it into meters, and then displays the result. (Duration: 45 min)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Quotient
{
    class Meter_Kilometer
    {
        static void Main(string[] args)
        {
            int nDistance, nResult;
            Console.WriteLine("Enter the distance in kilometers");
            nDistance = Convert.ToInt32(Console.ReadLine());
            nResult = nDistance * 1000;
            Console.WriteLine("Distance in meters:" + nResult);
            Console.ReadLine();
        }
    }
}

No comments:

Post a Comment