Per cent calculation
#8

Quote:
Originally Posted by Y_Leѕѕ
Quote:
Originally Posted by Joe Staff
percentages are floats anyway. And if you're trying to get the percentage given two numbers, then do

pawn Код:
new Current = 35
new Max = 50
new Float:percentage = (Current/Max)*100
printf("%f%%",percentage);
that would give 70%
No - that still has the same problem!

Код:
35 / 50 = 0
0 * 100 = 0
0 converted to a float = 0.0
floatdiv(current,max)*100 =p
Reply


Messages In This Thread
Per cent calculation - by Coicatak - 19.12.2009, 17:33
Re: Per cent calculation - by BeckzyBoi - 19.12.2009, 17:35
Re: Per cent calculation - by Joe Staff - 19.12.2009, 18:28
Re: Per cent calculation - by Coicatak - 19.12.2009, 18:44
Re: Per cent calculation - by Coicatak - 19.12.2009, 22:20
Re: Per cent calculation - by Coicatak - 19.12.2009, 22:45
Re: Per cent calculation - by DiddyBop - 19.12.2009, 23:43
Re: Per cent calculation - by Joe Staff - 20.12.2009, 00:46
Re: Per cent calculation - by Balon - 20.12.2009, 08:39
Re: Per cent calculation - by 1D10T - 24.01.2011, 14:40

Forum Jump:


Users browsing this thread: 1 Guest(s)