161k views
1 vote
convert the inchestocentimeters program to an interactive application named inchestocentimeterslnteractive. instead of assigning a value to the inches variable, accept the value from the user as input. display the measurement in both inches and centimeters—for example, if inches is input as 3, the output should be: 3 inches is 7.62 centimeters.

1 Answer

3 votes

Answer:

using static System.Console;

class InchesToCentimetersInteractive

{

static void Main()

{

const double CENTIMETERS_PER_INCH = 2.54;

double inches = 3;

WriteLine("Please enter the inches to be converted: ");

inches = double.Parse(ReadLine());

WriteLine("{0} inches is {1} centimeters", inches, inches * CENTIMETERS_PER_INCH);

}

}

Step-by-step explanation:

User Amit Deshpande
by
7.9k points