You really should explain your problem. What should it do, what it's actually doing, where you think the problem might be. If your compiler generated any error messages, what do they say, what line do they point to?
Yes, that works, but you're skating on thin ice (to get in an Olympics reference ;) )
20/100 by itself will not give you the 0.2 result you want. In your code, the operation is being coerced to floating point division by the fact that r is a float, and is an operand of the first operation carried out.
Why not just multiply by 0.2? Or at least ensure you get what you mean, and mean what you get, by using 20.0 / 100.0?
And as another aside, consider dropping the use of float type and always use doubles. Reserve floats for those cases where saving a lot of memory at the expense of some precision is a worthwhile tradeoff.