Or for rounding (warning, this comes from the web, in case your teacher checks):
Code:
float Round(float Value, int NumPlaces)
{
int k, Temp;
float Factor;
Factor = 1;
for (k = 0; k < NumPlaces; k++)
Factor = Factor * 10;
Temp = Value * Factor + 0.5;
return Temp / Factor;
}