Can Any One Check This Code Please
This is a Fahrenheit calculation program below
bool flag;
flaot tc,tg;
flag=float.TryParse(txtbox1.Text,out tc);
if(falg==false)
{
messagebox.show("Invalid Entry");
}
txtbox1.Focus();
return;
tg=(5/9)*(tc-32);
txtbox2.Text=tg.tostring();
when i run this program i am getting the result as "0"(i had taken tc=123 as a value)
NOTE: But If I Use Double Instead Of Float I Am Getting The Answer.Why Cant Float Get Answer instead Of "0".
|