I've got a problem. I'm attempting to make a Farenheit to Celcius calculator, and when I do the fraction part of math, it kinda doesn't work. It's either 0 or 1.
private void toCelcius_Click(object sender, EventArgs e)
{
double F = double.Parse(temperatureBox.Text);
double fm32 = F - 32;
double fraction = (9 / 5);
double newTemp = fraction*fm32;
temperatureLabel.Text = newTemp.ToString();
}
I've been using 100 as my test number, and everytime I send 100 to the textbox, it returns 68. It should be somewhere around 30ish.
Currently the program only senses the fraction as a 1. I tried using decimal instead of using double, but that breaks the newTemp problem. I tried using float, but got same results as a double. I have no freaking idea whats going on but it's very frustrating.
If anyone knows how to fix this, I'd be very thankful.
EDIT: Facepalm it's been such a long time since I've used doubles, forgot I needed to have the .0 after each number.