Percentage Calculation always returns 0

I am trying to calculate the percentage of something. It's simple maths. Here is the code.

float percentComplete = 0;
if (todaysCollection>0) {
    percentComplete = ((float)todaysCollection/(float)totalCollectionAvailable)*100;
}

Here the value of todaysCollection is 1751 and totalCollectionAvailable is 4000. Both are int. But percentComplete always shows 0. Why is this happening? Can any one Help me out. I'm new to Objective C.

9
задан BoltClock 4 September 2010 в 05:14
поделиться