The Crazy Chimp The Crazy Chimp - 7 months ago 54
Objective-C Question

Objective c division of two ints

I'm trying to produce a a float by dividing two

s in my program. Here is what I'd expect:

1 / 120 = 0.00833

Here is the code I'm using:

float a = 1 / 120;

However it doesn't give me the result I'd expect. When I print it out I get the following:



Do the following

float a = 1./120.