Visual Studio 2019 how to loop this code in c# 8.0
Visual Studio 2019
how to loop this code in c# 8.0
using System;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
double cm, meter, kilometer, mili;//primero se declaran las variables
Console.WriteLine("Introduzca los kilómetros");
kilometer = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Introduzca los metros");
meter = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Introduzca los centimetros");
cm = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Introduzca los milímetros");
mili = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Seleccione una opción");
Console.WriteLine("\ta-Conversion de kilometros a: ");
Console.WriteLine("\tb-Conversion de metros a: ");
Console.WriteLine("\tc-Conversion de centimetros a: ");
Console.WriteLine("\td-Conversion de milimetros a: ");
Console.Write("¿Tú opción? ");
switch (Console.ReadLine())
{
case "a":
Console.WriteLine("kilómetro a metro:" + (meter = kilometer * 1000.0));
Console.WriteLine("kilómetro a centimetro:" + (cm = kilometer * 100000.0));
Console.WriteLine("kilómetro a milimetro:" + (mili = kilometer * 1000000.0));
break;
case "b":
Console.WriteLine("metro a kilometro:" + (kilometer = meter / 1000.0));
Console.WriteLine("metro a centimetro:" + (cm = meter * 100.0));
Console.WriteLine("metro a milimetro:" + (mili = meter * 1000.0));
break;
case "c":
Console.WriteLine("centimetro a kilometro:" + (kilometer = cm / 100000.0));
Console.WriteLine("centimetro a metro:" + (meter = cm / 100.0));
Console.WriteLine("centimetro a milimetro:" + (mili = cm * 10.0));
break;
case "d":
Console.WriteLine("milimetro a kilometro:" + (kilometer = mili / 1000000.0));
Console.WriteLine("milimetro a metro:" + (meter = mili / 1000.0));
Console.WriteLine("milimetro a centimetro:" + (cm = mili / 10.0));
break;
}
}
}
}
![](/static/compass_v2/shared-icons/check-mark.png)
Step by step
Solved in 2 steps
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
- Recommended textbooks for youEBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,