Answer to Question #289876 in C# for Dimps

Question #289876

Write a program that converts pounds into kilograms. The program prompts the user to enter a number in pounds, converts it to kilograms, and displays the result. One pound is 0.454 kilograms. Here is a sample run:

1
Expert's answer
2022-01-22T16:36:01-0500


using System;
using System.Collections.Generic;
using System.Globalization;


namespace App
{




    class Program
    {
        static void Main(string[] args)
        {


            const double KILOGRAMS_PER_POUND = 0.454;	// Create constant value
            // Prompt user to enter the number of pounds
            Console.Write("Enter a number in pounds: ");
            double pounds = double.Parse(Console.ReadLine());
            // Convert pounds into kilograms
            double kilograms = pounds * KILOGRAMS_PER_POUND;
            // Display the results
            Console.WriteLine(pounds.ToString() + " pounds is " + kilograms.ToString() + " kilograms");
            Console.ReadLine();
        }
    }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS