0

please help me out! The Fahrenheit one is working ok but the celsius one is not working the output is always negative for some reason. I'm a beginner so please be beginner-friendly, I'm going by what my high school teacher has taught me and it has to include else if statements as that is our lesson.

double c= 0;
double f=0;
System.Console.Write(" would you like to convert from Celcius or Fahrenheit: ");
string x = Console.ReadLine();
x= x.ToUpper();

if (x == "Fahrenheit");
{
    System.Console.Write(" please enter degrees: ");
    f= Convert.ToDouble(Console.ReadLine());
    double  ferTocel = (f - 32) * 5 / 9; 
    System.Console.WriteLine(" Your new value in Degrees Celcius is: " + 
    ferTocel + " degrees celsius"); 
}
else (x == "Celsius");
{
    System.Console.Write(" please enter a celsius: ");
    c = Convert.ToDouble(Console.ReadLine());
    double  celTofer =  (9/5)* c + 32;

    System.Console.WriteLine(" Your new value in Degrees Fahrenheit is: " + celTofer + " degrees Fahrenheit");
}   
Aristos
  • 66,005
  • 16
  • 114
  • 150

0 Answers0