Hello,
I am writing a simple C program using Visual studio 2008.
And when I divide 5 / 9. I always get an zero. However, the correct value should be 0.5555.
Can anyone explain this?
Many thanks
Code://Calculate the temperature in celsius
int CalculateCelsius(int fahrenheit)
{
float valueA = 0;
int valueB = 0;
float celsius = 0;
valueA = 5 / 9; //Always displays zero
valueB = fahrenheit - 32;
celsius = valueA * valueB;
return (int) celsius;
}