It looks like you want to know how many lots of a certain size are in a particular number. I'd be tempted to try something like:
double round_up_to_nearest_lot( double quantity, double lot_size )
{
unsigned lots = unsigned( quantity / lot_size );
if( (lots * lot_size) < quantity ) lots++;
return lot_size * lots;
}
The key here to work out a low order estimate of how many lots minimum you need to cover a particular quantity then check that it's enough. If not bump the number by one and use that many lots.
Just re-reading your problem a bit.. you actually want to find the number of lots (i.e. cans of paint), so you could do something like:
unsigned number_of_lots_in_quantity( double quantity, double lot_size )
{
unsigned lots = unsigned( quantity / lot_size );
if( (lots * lot_size) < quantity ) lots++;
return lots;
}
and you'd call it along the lines of:
unsigned cans_of_paint_required( number_of_lots_in_quantity( area_to_cover, size_of_can ) );
Anyway, hope that's something approaching what you want and they way I've gone about it is understandable. Note that both those functions are going to be rubbish if the number of lots is greater than the size of an integer on your system.
Cheers,
Ash