Thanks all of you for your participation and interesting solutions. Most of them supersede mine, as they are shorter, faster and accept a wider range of operands, exactly what I expected them to be. Here are my solutions: