C# divide float by integer

Hello, I need to divide a float by and integer. I have tried casting but nothing seems to work. I would like to see .25 as my result in the following problem.

0.5/2 = .25

Here is some examples of what I have tried that doesnt work and the result it gave.
0.5/((float)2) = 0
0.5/2.0 = 0
((float).5)/((float) 2) = 0
(float).5/ 2 = 0

Thanks in advance!

That’s how it works by default. As long as one of the numbers involved in an operation is floating point, then the result is floating point and you don’t have to do anything special.

void Start () {
    Debug.Log (0.5f/2);  // result is .25
}

//c#
float result = 0.5f / 2;

//js
var result : float = 0.5f / 2;