I just started learning C #, I try a program that takes the temperature in degrees Fahrenheit and converts it to a target, and in the third step converts the target back to Fahrenheit (to check the math) I used the following code to execute the above function
Console.Write("Enter Your Temperature in fahrenheit : ");
float faren = float.Parse(Console.ReadLine());
float cel = (faren - 32)*(5/9);
float farenconv = 32 + (cel * 9 / 5);
Console.WriteLine("Orignal Temperature : " + faren);
Console.WriteLine("Converted in celsuis : " + cel);
Console.WriteLine("Converted Back in fahrenheit : " + farenconv);
Now the problem is what I get cel = 0as the output value no matter what I input as fahrenheit, but when I delete *(5/9), it works fine if there are any hints.
source
share