Asking for a help. How do I fix this?

62 Views Asked by At
`static void Main(string[] args)
    {
        double celsius, Fahrenheit;
        Convert.ToDouble(Console.ReadLine());
        Console.Write("Enter Fahrenheit temperature : ");
        celsius = (Fahrenheit - 32) * 5 / 9;
        Console.WriteLine();
        Console.WriteLine("\nThe converted Celsius temperature is : " + celsius);
        Console.ReadLine();
      
        }
    }
}`

I tried to different methods but it's seems like it doesn't work. I expect that you could help me and this program will work! thanks

1

There are 1 best solutions below

0
On
  1. You're printing the prompt to enter the temperature after reading the input for it with ReadLine.
  2. You never assign the read value to anything.

Try this:

Console.Write("Enter Fahrenheit temperature : ");
var fahrenheit = Convert.ToDouble(Console.ReadLine());  
var celsius = (fahrenheit - 32) * 5 / 9;